library(survival) # Table 3.1, p. 98 # Note: The z test in the table is the score test. The test labeled likelihood ratio is the # partial likelihood test. age.coxph <- coxph( formula=Surv(time,censor)~age, data=hmohiv, method="breslow", ) print(summary(age.coxph)) # Table 3.2, p. 103 inter.coxph <- coxph( formula=Surv(time,censor)~age+drug+age*drug, data=hmohiv, method="breslow") print(summary(inter.coxph)) # Note: In order to get the 95% CI for the hazard ratio we could use coxreg instead but then we have to have the predictors # all in one matrix or data set. So, we must create a dataset with just the two predictors and the # interaction (called da) in the data set called predictors. In this function the default for breaking ties is # Breslow. # Table 3.3, p. 105 main.coxph <- coxph( formula=Surv(time,censor)~age+drug, data=hmohiv, method="breslow") print(summary(main.coxph)) # Table 3.4, p. 108 # Note: SPLUS does have a method="exact" option # but it seems to cause problems when we tried to run it. breslow.coxph <- coxph( formula=Surv(time,censor)~age+drug, data=hmohiv, method="breslow") print(summary(breslow.coxph)) efron.coxph <- coxph( formula=Surv(time,censor)~age+drug, data=hmohiv) print(summary(efron.coxph)) #exact.coxph <- coxph( formula=Surv(time,censor)~age+drug, data=hmohiv, method="exact") #summary(efron.coxph)