# framingham data -- in 2 year slices ds = read.table("framDataR.txt",header=T) ds$chol.z = (ds$chol - mean(ds$chol))/sd(ds$chol) # product, in order to model changing beta for cholesterol ds$chol.z.fu.year = ds$chol.z * ( (ds$age.from+1) - ds$age ) ds[1:10,] # load survival package require(survival) # don't ask for exact methods with this many ties!! fit=coxph(Surv(age.from,age.to,case) ~ chol.z + chol.z.fu.year, data=ds ) # constant HR over follow-up time fitConstantHR =coxph(Surv(age.from,age.to,case) ~ chol.z , data=ds ); summary(fitConstantHR) # log(HR) linear over follow-up time fitLinearLogHR = coxph(Surv(age.from,age.to,case) ~ chol.z + chol.z.fu.year, data=ds ); summary(fitLinearLogHR)