This question is in general, but I would also like to know how the answer pertains to building the model in R.
I have some time to event data and want to do some survival analysis for it. For sake of example imagine that the response is some time to death value and that I have three groups A, B, and C. Now if I plot a KM curve for this data, given the fact that I have 3 groups, I will get three curves (one for each group).
No I am fitting the following model in R
model = coxph(Surv(time,censor) ~ group, data=death.data)
where group is a categorical variable with 3 levels pertaining to the three different groups: A, B, or C.
I am using the following command to plot the survival curves
plot(survfit(model,xlab ="Time",ylab="Survival"))
however, this only plots one curve. Is this what I should expect? Really I wanted three curves but am only getting one.
Does this imply that I need to build three survival models? One for each group, for example one model for group A versus other, one model for group B versus others, etc.? And if so, could I plot them all on the same graph and this would be equivalent to the KM curve representation?