Exercises for Mon Oct 1
1. On Mon Sep 24 I went through the essence of Nils Exercises 24, 25, 26, 27, including analysis of the pornoscope data. I then rounded off the material of Ch 3, and started on Ch 4. The datasets for both of Chs 4 and 5 are of the form (t_i, \delta_i, x_i), with time-to-event (possibly censored), an indicator for non-censoring, and covariates. On Mon Oct 1 I go further in Ch 3.
2. For Mon Oct 1, carry out the following exercise (which suitable edited will land in the Nils Collection). Go to the "some datasets" part of this website, and upload the dataset "heroin2-data" to your computer. It contains six columns, (id, tt, delta, x1, x2, x3), with explanation given in the "some datasets" part, for n = 238 Australian drug users. You should now carry out basic Cox regression for tt, the length of time a user stays in clinic, with respect to x1, x2, x3. Do this via
library("survival") # this is a package
well <- coxph(Surv(tt,delta) ~ x1 + x2 + x3)
summary(well)
Interpret this standard output of the coxph programme. Then try to programme the log-PL(\beta) yourself, Cox's log-partial-likelihood, and find both the maximum, \hat\beta, the Cox estimator, and the inverse Hessian matrix at that position. Then provide and plot estimates of the cumulative hazard curves for the time a drug addict will be in Clinic 1, and similarly in Clinic 2, if that person is given methadone dose 0.60 (on the scale for these data), and if he or she has not been in prison.