0
$\begingroup$

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

$\endgroup$
  • $\begingroup$ 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. $\endgroup$ – Cliff AB Dec 21 '15 at 14:23
  • $\begingroup$ 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] $\endgroup$ – Marcin Kosiński Dec 21 '15 at 16:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.