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

caspar caspar.hallmann at gmail.com
Mon Oct 22 12:54:44 CEST 2007

Dear Terry
Thanks for your reply,

I guess then including only the interaction term only should make sense, 
since a difference in group 1 between t=0 and t=1 is already taken into 
account in the baseline (all coefficients set to zero). My second group as I 
understand it should have an exp(coef_group2) higher/lower hazard at t=0, 
and exp(coef_group2+coef_group2:t) higher at t=1 as compared to the 
baseline. Am I correct so far?.

I have a second question that might be off topic, but though I'd have a fair 
chance off getting an answer at this mailing list. If I would assume a more 
or less constant hazard within periods 1 and 2, how would I get an average 
"daily" survival for each period on the probability scale? I thought of two 
options, 1 take the cumulative survival probability at time 13 (= my 
cutpoint) tmax, and take the 13- and tmax-  th root of it, or divide the 
ratio of S(t)/S(t-1) with the corresponding time difference between the two 
events, and then average over groups and periods. However , what would an 
appropriate method be to estimate the standard errors of the daily survival/ 
failure probabilities? Would the delta method do? And if so, does anyone 
known of a reproducible example?

Any help is very much appreciated
Thank in advance


Caspar Hallmann
MSc Student WUR
The Netherlands

----- Original Message ----- 
From: "Terry Therneau" <therneau at mayo.edu>
To: <caspar.hallmann at gmail.com>
Cc: <r-help at r-project.org>
Sent: Friday, October 19, 2007 3:30 PM
Subject: Re: X matrix deemed to be singular in counting process coxph

> 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