Rev 104 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
## Test the coxph program on the Ovarian data#xx _ order(ovarian$futime) #put data in same order as SAS green booktemp <- ovarian[xx,]attach(temp)# List the datatempsummary(survfit(Surv(futime, fustat)), censor=T)# Various modelscoxph(Surv(futime, fustat)~ age)coxph(Surv(futime, fustat)~ resid.ds)coxph(Surv(futime, fustat)~ rx)coxph(Surv(futime, fustat)~ ecog.ps)coxph(Surv(futime, fustat)~ resid.ds + rx + ecog.ps)coxph(Surv(futime, fustat)~ age + rx + ecog.ps)coxph(Surv(futime, fustat)~ age + resid.ds + ecog.ps)coxph(Surv(futime, fustat)~ age + resid.ds + rx)# Residualsfit <- coxph(Surv(futime, fustat)~ age + resid.ds + rx + ecog.ps )resid(fit)resid(fit, 'dev')resid(fit, 'scor')resid(fit, 'scho')fit <- coxph(Surv(futime, fustat) ~ age + ecog.ps + strata(rx))summary(fit)summary(survfit(fit))sfit <- survfit(fit, list(age=c(30,70), ecog.ps=c(2,3))) #two columnssfitsummary(sfit)detach(w=2)# Test the robust=T option of coxphfit <- coxph(Surv(futime, fustat) ~ age + ecog.ps + rx, ovarian, robust=T)rr <- resid(fit, type='dfbeta')all.equal(as.vector(t(rr) %*% rr), as.vector(fit$var))