1
$\begingroup$

I have a question about logistic regression in R. I want to study the influence of certain comorbidities in patients in predicting deceased status(Y/N). So far, I formatted all my comorbidities(17) into dummy variables having 'none' as the reference variable. When I see logistic regression tutorials, it all seem to code categorical variables as exclusive, while mine are not, meaning one person might have up to 10 different comorbidities.

Taking the idea from a few posts I have seen, I would have a category named comorbidities, and then repeat each subject ID for each comorbidity present and then let R code the dummies.

Would logistic regression be the correct way to approach this situation? Would I have to group the comorbidities in a way that a subject can only have one and only one comorbidity and none for the others?

$\endgroup$
3
  • 1
    $\begingroup$ Start with the model with all 17 dummies. You probably want age in there too, which is not a dummy. Age is not linearly related to survival, so you may need to include a quadratic term. Certain combinations of comorbidities can be especially lethal so you need to consider including product terms. Yes, use logistic regression. Depending on your sample size you may need to prune the model, but scientifically, the more complete model is always more accurate as a representation of what is really going on. $\endgroup$ Commented Jan 5, 2021 at 12:08
  • $\begingroup$ Same Q (no answers): stats.stackexchange.com/questions/456115/… $\endgroup$ Commented Jan 5, 2021 at 17:56
  • $\begingroup$ stats.stackexchange.com/questions/30818/… $\endgroup$ Commented Jan 5, 2021 at 17:59

1 Answer 1

1
$\begingroup$

A factor variable with (in your case, 17) possible levels, is meant for the case with mutually exclusive categories. So, in your case, define in its place 17 binary factors, one for each possible level. Then, with a logistic (or other ...) regression model, define the linear predictor $\eta$ as $$ \eta = \beta_0 +\sum_j \beta_j x_j $$ where each $x_j$ is binary $0/1$. One binary variable for each comorbidity. This is an additive model, and that is maybe not realistic, as it assumes that the effect of the comorbidity $x_j$ is the same irrespective how many other comorbidities are present. So maybe try to introduce interactions: $$ \eta = \beta_0 +\sum_j \beta_j x_j + \sum_{j<k}\beta_{jk} x_jx_k $$ but with 17 different levels that have $1+16+120$ parameters, which might be too many ... So you try some kind of structured interaction, for example assuming that all the $\beta_{jk}$'s are equal. In that case, note that $\sum_{j<k} x_j x_k = \binom{m}{2}$, where $m=\sum x_j$ is the number of active comorbidities. Other variants are certainly possible.

$\endgroup$

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.