Hello,
I posted a question but seems like was very bad and not clear at all so I did not get any help. I worked on my question and made it 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)
of course the status is all 1 (means the dead)
@Kevin Blighe Thanks a lot Kevin for your very nice response, If I get the info for the alive patients in each hour and expand the dead ones , would it solve the issue?
It may help - yes. Can you get that information? Please be sure about the information that you need, though. You could take a look at other examples online, including the example that I showed.
For survival, we want to know those who died and those who never died within the time-frame of the study. Each individual should have a single record, i.e., a single row per patient in the data, with death encoded as
0
|1
.If you take a look at the data in my other thread, I will provide a few explanations:
Basically, if you look through the data and compare it to the plot, you can see that:
Not that survival says nothing about the days after the final day of the study. For all intents and purposes, all patients may have died at day 162, a day for which we have no data. This is why it's important to not manipulate survival data in order to make, e.g., a treatment / drug look favourable.
You could show this to your collaborator so that you get the correct data.
The data that you have can still be used, by the way - it could be a table in a manuscript.
@Kevin Blighe
Hi Kevin,
I removed those patients with no tag , I removed the hours that they didn't follow up. Now I cleaned the data and it looks like the following, what do you think?
1 means it is still alive and 0 means it is died
That looks a lot better, and more favourable for the drug.
Just one thing: the
Condition
should be encoded the other way:.
Be very careful with the
leg.text
parameter - it should be in the same order as per the categorical variable, 'Sample', i.e., order of factors indf$Sample
should be the exact same as order of strata listed inleg.text
Some simple stats:
So, we can say:
Great work
Kevin
@Kevin Blighe
Thanks a bunch, you put some time to guide me and I need to do some home work to digest the command you gave. I really appreciate your answer. I will let you know as soon as I get the point across. I liked all your answer and accepted it
Thanks again Kevin
@Kevin Blighe Hi, I posted a new question regarding drug_1 versus WT and drug_2 versus WT. Can you please have a look and give me some idea how to perform the statistic on that? thanks a lot
@Kevin Blighe
I like this show.n.risk = TRUE however, is it possible to make a distance between the lable and the values? I looked at info but I could not find anything. it seems just playing with n.risk.cex but when the data gets big it is a mess. any idea ? another problem is with sample size, in one condition is different than the other. so do you know a better test that I could perform in order to get a more robust result?