how to perform survival analysis on a corrected and structured data
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)
• 160 views
•
link
0 answers
No answers yet.
Log in to answer this question.
Hello and welcome. Is this part of a tutorial or exam?
Your data looks like this:
Which is the 'first condition'?; which is the 'second condition'?; where is the information about death? I would appreciate it if you could help us, so that we could begin to help you.
@Kevin Blighe I just updated my question and thanks a lot , it is not tutorial or home work, it is a real data
I will have to take another look in the morning. In R, though, most survival functions are based on
survival::Surv(). For example, if we wanted to do a Cox proportional Hazards Survival model, we would do:I think that you need to really understand that the input data is correct, though.
If anybody else wants to take a look, please, feel obliged.
@Kevin Blighe
I just revised my question, now it is more clear. can you please have a look and let me know your ideas?
thanks
Hi, I think that you first need to determine if the data is suitable for survival. Please read the help pages for the functions that you are using.