Please submit code along with solutions.

Question 1. (6 points)

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:

fit <- coxph(Surv(time,death_obs)~SLC7A11_ex,data=kirc_small,method="breslow")
##  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.

Question 2. (8 points=2 points/part)

Complete Question 8.10 in textbook (on page 291).