Displaying 2 results from an estimated 2 matches for "survobject".
Did you mean:
subobject
2006 Mar 15
5
Surv object in data.frame
...Surv(starttime, stoptime, event)
## Cox-regression
coxph(survobj~group) # this works
## put Surv object in data.frame
df.test <- data.frame(survobj=I(survobj), group)
## Cox-regression on data.frame
coxph(survobj~group, data=df.test) # this does not work
attr(df.test$survobj, 'class') # survobject has class "AsIs", "Surv"
attr(df.test$survobj, 'class') <- c('Surv', 'AsIs') # put Surv first
attr(df.test$survobj, 'class') # survobject has class "Surv", "AsIs"
coxph(survobj~group, data=df.test) # now it works
2011 Jun 16
0
coxph: cumulative mortality hazard over time with associated confidence intervals
Dear R-users,
I computed a simple coxph model and plotted survival over time with
associated confidence intervals for 2 covariate levels (males and
females).
M1 <- coxph(survobject~sex, data=surv)
M1
survsex <- survfit(survobject~sex,data=surv)
summary(survsex)
plot(survsex, conf.int=T, col=c("black","red"), lty = c(1,2),
lwd=c(1,2), xlab="Time", ylab="Survival probability")
legend(10, 0.2, c("males","females"), c...