0

I'm studying all-cause cancer incidence in a large population.

Since it is an important confounding factor for many cancers, I'd like to adjust for hormonal contraception and hormone replacement therapy, but in women only.

Of course, this effect itself depends on the menopausal status of women.

In a Cox PH model on cancer events, I tried to add interaction terms like this:

m1 = coxph(Surv(age_origin, age_surv, event_surv) ~ X + Y + Z + 
           sex*menopause*pill + 
           sex*menopause*HRT, 
           data=db)

Of course, this model did not fit, and I guess it was because (hopefully) no men had menopause nor was on the pill, so the effect was monotonous in the men sub-group.

For R enthusiasts, the error was:

Error in contrasts<-(*tmp*, value = contr.funs[1 + isOF[nn]]) :
contrasts can be applied only to factors with 2 or more levels

Is it possible (and does it make sense) to account for such an effect?

Dan Chaltiel
  • 1,089
  • 12
  • 25
  • Maybe this is relevant: https://stats.stackexchange.com/questions/372257/how-do-you-deal-with-nested-variables-in-a-regression-model – periwinkle May 29 '19 at 14:26
  • @winperikle very relevant indeed thanks! Though, i wonder how should I include the 3rd order interaction term. Any idea? – Dan Chaltiel May 29 '19 at 15:16

0 Answers0