[R] nesting in CoxPH with survival package

David Winsemius dwinsemius at comcast.net
Sat Jan 12 22:03:21 CET 2013

On Jan 11, 2013, at 5:35 PM, Katie Anweiler wrote:

> Hello all,
> I am trying to understand how to specify nested factors when using
> coxph(), and if it is appropriate to nest these factors in my
> situation.
> In the simplest form, I am testing two different temperatures, with
> each temperature being performed twice in different experimental
> periods (e.g. Temp5 performed in Period A and C, Temp4 performed in
> Period B and D)
> I am trying to see if survival time is affected by the treatment
> temperature.  To do this I am using temperature and experimental
> period nested within temperature as factors.
>> LOEtempmod.5days=coxph(LOE.stable.5days~Temp+Temp/ 
>> Period,data=goodstable)
> Warning message:
> In coxph(LOE.stable.5days ~ Temp + Temp/Period,  :
>  X matrix deemed to be singular; variable 2 5 6 7
> 1. Is this an appropriate way of nesting?

Have you looked at the coxme package?

> 2. Can this error message be ignored?

Sometimes R packages correctly drop variables that are exactly  
collinear: other times the correct solution is not clear. I would  
think the answer in this case would be "no", but do not have a lot to  
go on at this point.


David Winsemius, MD
Alameda, CA, USA

More information about the R-help mailing list