[R] X matrix deemed to be singular in counting process coxph

Terry Therneau therneau at mayo.edu
Fri Oct 19 15:30:45 CEST 2007


 What you have is a slightly more subtle variant of the following:

   library(survival)
   data(lung)	
   mydata <- cbind(lung, newvar =2)
   coxph(Surv(time, status) ~ ph.karno + newvar,  mydata)

                coef exp(coef) se(coef)     z     p
    ph.karno -0.0164     0.984  0.00585 -2.81 0.005
    newvar        NA        NA  0.00000    NA    NA


 You have created a data set where at all times <13 the variable t=0, and at all 
times >13 the variable t=1.  The Cox model compares the values of the covariates 
of each subject who died to the values of those who did not die, using the 
current covariate values AT THAT TIME.  Since the value of your "t" is always a 
constant within the set, the variable contains no information for discriminating 
the events from the non-events.  Zero information --> a coefficient of NA.
 
 	Terry Therneau   
 	Mayo Clinic



More information about the R-help mailing list