3

I am trying to estimate Cox proportional hazards model for transition from state 1 to state 2 using R survival package as follows:

Altman <- coxph(Surv(Tstart, Tstop, to == 2) ~ wWCTA + wRETA + wEBITTA + wMETL + 
            wSTA, data=Multistate, subset = from == 1, 
          frailty(x=id, distribution= "gamma"))

When I am estimating the model without the frailty argument, its working fine. But when I am including it, I am getting the following error:

Error in if (any(ord > 1)) stop("Penalty terms cannot be in an interaction") : 
missing value where TRUE/FALSE needed

Can anyone please explain where I am going wrong?

Regards,

J

talat
  • 68,970
  • 21
  • 126
  • 157
Jairaj Gupta
  • 347
  • 4
  • 16

1 Answers1

4

I had the same problem but eventually realized that the frailty term is additive! That is, it shouldn't come after a comma but after a plus.

Changing your code to the following should thus solve the problem:

Altman <- coxph(Surv(Tstart, Tstop, to == 2) ~ wWCTA + wRETA + wEBITTA + wMETL + wSTA + frailty(x=id, distribution= "gamma"), data=Multistate, subset = from == 1)
Daniel W
  • 53
  • 7