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
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)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.