Closed:how to perform survival analysis on a corrected and structured data
0
0
Entering edit mode
4.0 years ago
Learner ▴ 280

Hello,

I asked a question but seems like it was not very clear. I have studied and structured the data better and it is with 3 columns first column show 2 category (Drug means drug was added and the patient was monitored ) and WT (means wild type) The second column shows the number of dead patient. The third is the hour that it happened

df<- structure(list(Condition = structure(c(1L, 2L, 1L, 2L, 1L, 2L, 
1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 
1L, 2L), .Label = c("Drug", "WT"), class = "factor"), Number.of.Dead = c(18L, 
29L, 21L, 28L, 11L, 23L, 12L, 20L, 10L, 18L, 9L, 16L, 9L, 15L, 
8L, 14L, 7L, 13L, 6L, 12L, 3L, 12L, 2L, 10L), Time = c(1L, 1L, 
2L, 2L, 3L, 3L, 4L, 4L, 5L, 5L, 6L, 6L, 7L, 7L, 8L, 8L, 9L, 9L, 
10L, 10L, 11L, 11L, 12L, 12L)), row.names = c(NA, -24L), class = "data.frame")

Now I am doing the following but the output is a bit strange, what am I missing here?

require(survcomp)
require(survival)

km.coxph.plot(formula.s=Surv(Number.of.Dead,Time) ~ Condition, data.s=df, mark.time=TRUE,
              x.label="Time (Hours)", y.label="Overall survival", main.title="",
              leg.text=c("Drug", "WT"), leg.pos="topright", leg.bty="n", leg.inset=0,
              .col=c("forestgreen","red3"),
              xlim=c(0,40),
              o.text="",
              .lty=c(1,1), .lwd=c(1.75,1.75),
              show.n.risk=TRUE, n.risk.step=10, n.risk.cex=0.8, verbose=FALSE)
r • 114 views
ADD COMMENT
This thread is not open. No new answers may be added
Traffic: 2150 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6