0

Is there any existing function in R or package that calculates gradient of partial log-likelihood function in Cox proportional hazards model?

I've tried myslef on this question (How to compute gradient of partial log-likelihood function in Cox proportional hazards model?) but it's probably too long to read so this is a summary of that question

Marcin
  • 1,049
  • If you're having trouble writing a function to calculate the first derivatives and you've written the likelihood function correctly, a good place to start is with a function that calculates the derivatives numerically. You can then use this to help debug the analytic calculations. I don't think I've ever successfully coded a derivative function without doing this. – Cliff AB Dec 21 '15 at 14:23
  • I am not sure whether I have caluclated likelihood correctly. I am taking lok-lik values from survival::coxph and then there is C implementation for that I don't understand. example coxph(Surv(t, c) ~ x, init = c(0), control=list('iter.max'=0))$loglik[2] – Marcin Dec 21 '15 at 16:03

0 Answers0