3
$\begingroup$

When performing survival analysis with mixed models I've usually used random intercept or random intercept and random slopes models with these codes in R:

Random intercept:

coxme(surv~variable1+ (1|grouping))

Random intercept and slope:

coxme(surv~variable1 + (1+ variable1|grouping))

With variable1 being a categorical dummy variable (1,0) and grouping variable being a nominal categorical variable (from 1 to x without order).

However, a colleague of mine told me that these models are not correct to perform these analyses as they do not assume a variable effect for each group, and told me to use this model that sound odd to me, as it removes the intercept:

coxme(surv~0+variable1+(variable1-1|grouping))

How should I interpret this code, as it looks like a pure random slope without intercept?

$\endgroup$
2
  • $\begingroup$ Is variable1 categorical (factor) or continuous? $\endgroup$
    – PBulls
    Commented Dec 15, 2023 at 8:58
  • $\begingroup$ Categorical, more specifically is a binary variable, while groping is a nominal categorical variables (no order assumed). I edited the original question to be clear for future readers. $\endgroup$ Commented Dec 15, 2023 at 8:59

1 Answer 1

3
$\begingroup$

A Cox model does not fit an intercept parameter, see for example this question for some discussion. Therefore, fitting surv ~ variable1 or surv ~ 0 + variable1 will produce exactly the same parameters. coxme calls the default coxph.fit method if you don't have time-dependent covariates, so the behaviour will be the same as the fixed effects-only coxph.

library(survival)
data(cancer)
fit1 <- coxph(Surv(time, status) ~ celltype, data=veteran)
## Explicitly 'remove' intercept
fit2 <- coxph(Surv(time, status) ~ 0+celltype, data=veteran)

## Notice how *only the formula* (call) differs
all.equal(fit1, fit2)
> "Component “terms”: formulas differ in contents"
> "Component “formula”: formulas differ in contents"            
> "Component “call”: target, current do not match when deparsed"

For your random effect, it is not really accurate to call a categorical/dummy covariate a 'slope' - this is usually the term used for a continuous variable that has a linear effect over its range. However, it turns out this is how coxme was implemented in that it only accepts a single numeric effect besides an intercept in the random effect specification. You are actually trying to fit multiple random intercepts, which might lead to some undesirable side effects.

The first specification, (1 + variable1 | grouping), will fit an overall intercept and a 'slope' which is really just an intercept in the non-reference level of variable1. I'm not going to pretend I know much about the fitting algorithm inside coxme but I would assume that this produces roughly the same result as if you were fitting a separate intercept to each level of variable1 (which the package does not allow directly). Compare this to how removing an intercept from a standard linear model changes the interpretation of categorical predictors from differences vs. reference to the mean in each category.

The second specification, (variable1 | grouping), will fit only a random 'slope', which in your case becomes an intercept for the non-reference level only. This is not only a much less flexible structure, I'm quite sure that this is not what you want if your goal is to "assume a variable effect for each group" (where I'm taking "group" to mean "levels of variable1", because all models will produce separate random effects across all levels of grouping regardless).

$\endgroup$
3
  • $\begingroup$ Many thanks for the clarification! So, if I understand right, using (variable 1- 1|grouping) would give me an unreliable effect, as we are not checking the so called "fragility", right? $\endgroup$ Commented Dec 15, 2023 at 10:44
  • 1
    $\begingroup$ You still have a random effect, but I'm quite sure it's being fit on observations where variable1 = 1 (or $\ne 0$) only. $\endgroup$
    – PBulls
    Commented Dec 15, 2023 at 10:46
  • $\begingroup$ Many thanks, you've been cristal clear. $\endgroup$ Commented Dec 15, 2023 at 10:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.