Displaying 1 result from an estimated 1 matches for "wlwsn1curv".
Did you mean:
wlwsn1curve
2008 Nov 11
1
using newdata in survfit with categorical variable
...or a pseudo cohort by using survfit based on Cox regression. My codes are shown below:
fit<- coxph(Surv(end, status2)~gender, data=wlwsn1)
Summary(fit)
coef exp(coef) se(coef) z p
genderMale 0.204 1.23 0.0912 2.23 0.025
temp<-data.frame(gender='Male)
wlwsn1curve<-survfit(fit, newdata=temp)
Then I got error message:
Error in `contrasts<-`(`*tmp*`, value = "contr.treatment") :
contrasts can be applied only to factors with 2 or more levels
I do not know what this error message indicates, do I have to recode gender to 0,1 to get it throug...