Cox regression in XLISP-Stat



This is the current version of a proportional hazards regression object for XLISP-Stat along the lines of the glim and regression objects that come with the system.

Feel free to take it and use it: formal details in the file COPYING


Back to my XLISP-Stat page, my work homepage or my personal homepage.


Version 1.1 (9/98): Published in the Journal of Statistical Software.3:2;1-90. Added cohort expected survival and some more neat graphics comparing observed and expected survival curves.

Version 1.0: rewritten using the noweb literate programming system. Added lots of documentation and examples. Now includes the model formula system

Version 0.6: bug fix: corrected loglikelihood computations with ties. Added some more graphical diagnostics.

Version 0.5.

This fits the stratified Cox regression model to data with right censoring and optional left truncation. Both the Efron and Breslow (Peto) adjustments for ties are available. In addition to time-dependence in step-function form which can be done with truncation/censoring there is a facility for arbitrary continuous time-dependence (which is slow). Plots of the baseline survival and hazard functions and of the scaled Schoenfeld residuals are available, as are tests of the proportional hazards assumption based on (scaled) Schoenfeld residuals (Grambsch and Therneau, Biometrika, 1994). Agnostic (model-robust) variance estimators and martingale and score residuals are available for the basic models but not for arbitrary continuous time-dependence.

Some testing has been done, against S-PLUS and SPIDA.

There is a function to compute score tests for a Cox model. In untied data this is equivalent to the logrank test and so gives stratified, k-sample logrank tests allowing left truncation and allowing tests for linear trend. In tied data it is slightly conservative.

The fitting procedure runs significantly faster when compiled, particularly with arbitrary time-dependence..


Noweb code for program and examples (requires noweb to use). I strongly recommend this version if you might be interested in editing the code. survival.tar.gz (86k)

Alternatively, you can get the prebuilt version (prebuilt.tar.gz) or just the PostScript documentation(463k) or PDF documentation(774k). As you can see, generating the documentation yourself saves much bandwidth.


There is demonstration applet that fits the Mayo primary biliary cirrhosis model and demonstrates some dynamic graphics. (it's pretty big: 125k). You need to have XLISP-Stat set up as the viewer for MIME type application/x-xlispstat

Some examples of plots produced from the Mayo PBC data with this code and de Leeuw & Udina's gnuplot interface:


For people who can't cope with tar files, here are all the files for the prebuilt version coxreg.lsp, sliders.lsp, expsurv1.lsp,coxdemos.lsp,pbc.lsp,cgd.lsp, COPYING, README. pbc-new.lsp

Planned Features for the future

Fairly likely Weighted logrank tests, logrank supremum tests; Weighted Cox regression; Lin & YIng's additive model

Maybe sometime Exact partial likelihood for ties; Aalen's additive hazard model; frailty models.