Please submit code along with solutions.
Write a R
(or python or matlab) function to compute the Breslow partial log likelihood for the Cox proportional hazards model (log of Equation 8.4.1 in textbook) for a one-dimensional parameter \(\beta\). This function should take \(\beta\) as well as the data as arguments. Test your function by finding the MLE on the kirc_small.RData
data set using SLC7A11_ex as a predictor. You can use a grid search or an R
optimizer such as optimize
. Your MLE should match the parameter estimate here:
load("kirc_small.RData")
library(survival)
fit <- coxph(Surv(time,death_obs)~SLC7A11_ex,data=kirc_small,method="breslow")
coef(fit)
## SLC7A11_ex
## 0.002459945
You may use the solution from the above code to guide your starting value for the grid search or optimize
function.
Complete Question 8.10 in textbook (on page 291).