Skip to content
Prev 315963 / 398502 Next

nesting in CoxPH with survival package

Thank you for the suggestions.

Just to clarify, my first question was more on what actual coding I
should be using to indicate a nested variable when using the coxph()
function.  I asked this after consulting several times with a local
statistician, but unfortunately neither of us are very familiar with
R.

After further consultation, I have changed the design to a 2*2 design
(2 levels of ExpTemp and Stability each) with blocking (Period).  I am
still getting the "x matrix deemed to be singular" error.
Warning message:
In coxph(LOE.fit ~ ExpTemp + Stability + Period, data = goodexp) :
  X matrix deemed to be singular; variable 5
Call:
coxph(formula = LOE.fit ~ ExpTemp + Stability + Period, data = goodexp)

  n= 184, number of events= 105

                    coef exp(coef) se(coef)      z Pr(>|z|)
ExpTemp         -3.17825   0.04166  0.53105 -5.985 2.17e-09 ***
StabilityStatic -0.84129   0.43115  0.20470 -4.110 3.96e-05 ***
PeriodB          1.06794   2.90937  0.22859  4.672 2.98e-06 ***
PeriodC          1.23853   3.45054  0.58457  2.119   0.0341 *
PeriodD               NA        NA  0.00000     NA       NA
---
Signif. codes:  0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1

                exp(coef) exp(-coef) lower .95 upper .95
ExpTemp           0.04166    24.0047   0.01471     0.118
StabilityStatic   0.43115     2.3194   0.28866     0.644
PeriodB           2.90937     0.3437   1.85877     4.554
PeriodC           3.45054     0.2898   1.09723    10.851
PeriodD                NA         NA        NA        NA

Concordance= 0.833  (se = 0.03 )
Rsquare= 0.591   (max possible= 0.995 )
Likelihood ratio test= 164.4  on 4 df,   p=0
Wald test            = 111.1  on 4 df,   p=0
Score (logrank) test = 179.9  on 4 df,   p=0
, , ExpTemp = FIVE

             Period
LOEStatusfull  A  B  C  D
                  0 42  0 35  0
                  1  4   0 11  0

, , ExpTemp = FOUR

             Period
LOEStatusfull  A  B  C  D
                  0  0  0   0  2
                  1  0 46  0 44

As best as I can tell, none of my variables are collinear.  Are there
any other suggestions of how to deal with this error, or any more
information I can provide to help understand why I would be getting
this?

Thank you for your time and your help,

Katie
On Sat, Jan 12, 2013 at 4:54 PM, Bert Gunter <gunter.berton at gene.com> wrote: