# R adds unexpected variable to interaction model

Not sure if this is more of a programming question (in which case please move to stack overflow) or a statistical model question (in which case, please read on!)

I'm exploring a data set and doing cox proportional hazards regression.

One of my variables did not satisfy the proportional hazards assumption so I decided to stratify by that variable.

Stratifying by the variable will assume that the effect of all covariates is the same in each stratum but each stratum has different baseline hazards.

To check this I test for an interaction between the stratifying variable and each covariate. When I run any model with interactions R does something that is unexpected to me:

Call:
coxph(formula = Surv(NRM_time, NRM_status) ~ strata(chemosens) +
remission + chemosens * (high.LDH + working) + eversmoke +
etoh.current + married - chemosens, data = data)

coef exp(coef) se(coef)      z       p
remission1           -0.6206     0.538    0.192 -3.225 1.3e-03
high.LDH1             0.8181     2.266    0.177  4.635 3.6e-06
working1             -0.4329     0.649    0.204 -2.121 3.4e-02
eversmoke1            0.1698     1.185    0.125  1.358 1.7e-01
etoh.current1        -0.1633     0.849    0.124 -1.322 1.9e-01
married1             -0.0607     0.941    0.133 -0.455 6.5e-01
high.LDH0:chemosens1  0.8353     2.305    0.255  3.270 1.1e-03
high.LDH1:chemosens1      NA        NA    0.000     NA      NA
working1:chemosens1   0.7644     2.148    0.299  2.553 1.1e-02

Likelihood ratio test=40  on 8 df, p=3.19e-06  n= 738, number of events= 267
(38 observations deleted due to missingness)


As you can see, all my covariates are dichotomous. When I fit the model with interaction between chemosens and both high.LDH and working why does R have an interaction term for chemosens with high.LDH0 AND high.LDH1 (as opposed to just high.LDH1 like it did for working).

• Yes, it seems to be because I take out the main effect of chemosens (since the data is stratified by chemosens). – bdeonovic Nov 26 '14 at 17:06
• Than you have your answer. – Tim Nov 26 '14 at 17:09
• Indeed, that wasn't too complicated. You can write a quick blurb as an answer and I can select it if you want. – bdeonovic Nov 26 '14 at 17:10

My guess is that the chemosens * (high.LDH + working) part of the formula got translated into: working1:chemosens1, high.LDH0:chemosens1, and high.LDH1:chemosens1, while working0:chemosens1 seems to be baseline for the comparison. So you got what you asked for: interaction of chemosens with two variables. This kind of things happen if you remove intercept from the model.