Dear all, I have a question with respect to counting process formulation of the coxph(survival) model. I have two groups of observations for which I have partitioned each observation into two distinct time intervals, namely, entry day till day 13, and day 13 till death or censorship day (of course the latter only for the observations that survived the first 13 day interval), and added a dummy 't' representing the first and second interval [0,1]. The reason I want this is because the groups have crossing survival curves and I happen to know that the change in hazard ratio between the groups occurs at day 13. I try the following:> coxph(Surv(Start,Stop,event)~group*t+cluster(nr),data=dat4)Call: coxph(formula = Surv(Start, Stop, event) ~ group * t + cluster(nr), data = dat4) which results in : coef exp(coef) se(coef) robust se z p group 0.336 1.400 0.0409 0.0408 8.24 1.1e-16 t NA NA 0.0000 0.0000 NA NA group:t -0.689 0.502 0.0530 0.0530 -13.02 0.0e+00 Likelihood ratio test=180 on 2 df, p=0 n= 13244 Warning message: X matrix deemed to be singular; variable 2 in: coxph(Surv(Start, Stop, event) ~ group * t + cluster(nr), deleting all terms apart from 't' still results in the same warning. I seem to have been stuck on this one. Does anyone known or have any suggestions why t can't be estimated? I haven't been able to find any help on the RSiteSearch. Many thanks in advance. Caspar PS: I could send a some of this dataset if anyone interested for a tryout Caspar Hallmann MSc Student WUR The Netherlands
Terry Therneau
2007-Oct-19 13:30 UTC
[R] 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
Maybe Matching Threads
- stepAIC and polynomial terms
- Teasing out logrank differences *between* groups using survdiff or something else?
- Coxph frailty model counting process error X matrix deemed singular
- Deciles and R
- Losing factor levels when moving variables from one context to another