The survival package in R appears to focus on continuous time survival models. I am interested in estimating a discrete time version of a proportional hazard model, the complementary log-log model. I have a fairly straightforward survival model, with simple right censoring.

I know that one way to estimate this model is to create a data set that has a separate row for each observation for each period in which it isn't "dead." Then, a glm model with the cloglog link can be used.

This approach seems very memory inefficient; indeed, it would likely produce a data set that is too large for the memory on my machine.

A second approach would be to code up the MLE myself. That would be simple enough, but I am hoping that there is a package that has this survival model canned. It would just be easier for collaboration and to avoid coding errors to use a package.

Does anyone know of such a package?

  • 2
    $\begingroup$ If this is discrete time, you must have a lot of ties, right? I'm under the impression that coxph(ties="exact"), in the standard survival package, makes the model "a conditional logistic model, and is appropriate when the times are a small set of discrete values". Would this not work for you? Is that b/c it wouldn't be using the cloglog link? $\endgroup$ Commented Apr 2, 2013 at 22:33
  • 1
    $\begingroup$ @gung, Thanks for the pointer; I didn't know about that feature. I would prefer to use the cloglog link, though. $\endgroup$
    – Charlie
    Commented Apr 2, 2013 at 23:47

1 Answer 1


Having several rows for each observation may seem redundant, but, likely, it's not. If there are any time-varying covariates in the model, then each observation-month will certainly need its own row. One particular example of a time-varying covariate is the elapsed time. Since this variable should almost certainly be included in the model, it makes sense to have a separate row for each observation-period. Thus, the first approach suggested is likely the best one.

Note that this is different from a continuous time proportional hazards model with a Weibull distribution. There, the survival model can be simplified to a single line for each observation if time elapsed is the only time-varying covariate (see here, for example). A similar result holds for the Cox proportional hazard model.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.