7
$\begingroup$

Logistic regression is often used to identify the effect of $x$ on a binary variable $y$ after adjusting for potential confounders $x_1,...,x_n$. In the medical literature, I will sometimes encounter a statement as follows:

The relationships between $x_1,...,x_n$ and $y$ were each evaluated to identify non-linear relationships. When a non-linear relationship was identified, cut-offs were visually chosen to categorize the variable.

That is, the non-linear nature of the relationship was "accounted for" by categorization. As expounded upon here and elsewhere, this is not good practice for a number of reasons.

The issues with this approach not-withstanding, I realize that I am not sure exactly how this visualization can be done. The most obvious interpretation is that they are visualizing the $x_i$ vs. $y$ plots for each $i$. However, this does not account for correlations between the $x_i$. That is, if $x_1$ and $x_2$ are not independent, then the relationship between $y$ and $x_1$ might be affected by inclusion of $x_2$ in the model--potentially rendering the cut-offs meaningless.

How can one visualize the relationship between $y$ and $x_i$ while adjusting for the other $x_j$ for $j\neq i$? I think this can be done by regressing all the other $x_j$ to $y$, and then somehow plotting the residual against $x_i$. Would this be the "correct" procedure? If the relationship between $y$ and $x_i$ changes when you include $x_j$ for $j\neq i$, then in what "order" would you then categorize the variables?

Again, this is not a question about the pitfalls of categorization. Rather, I am trying to understand how categorization by visualization could even be done in the first place, when the relationship between $x_i$ and $y$ is affected by the other covariates.

$\endgroup$
4
  • $\begingroup$ The quotation suggests only the bivariate relationships were evaluated (perhaps using methods like those in stats.stackexchange.com/questions/14480) without controlling for the other variables. You're almost correct with your proposal, but you should plot the $y$ residuals against of the residuals of $x_i$ (after regressing the latter against all the $x_j,$ $j\ne i.$). This is a form of "added variable plot." Another approach adds nonlinear terms to the model $y\sim x_1+\cdots+x_n,$ typically of the form $x_i\log x_i,$ $\log x_i,$ or $x_i^2,$ depending on the ranges of the $x_i.$ $\endgroup$
    – whuber
    Commented Apr 26, 2020 at 20:53
  • $\begingroup$ @whuber That is very helpful, thank you! The name "added variable plot" is exactly what I needed. Would you agree, though, that this is another reason to not choose cutoffs by visually evaluating the bivariate relationships? That is, the cutoffs may change when you control in the other variables. $\endgroup$ Commented Apr 26, 2020 at 22:22
  • $\begingroup$ Perhaps this is what you were getting at with the post you linked me to, but I am not sure exactly what the y axis would be in these bivariate plots. Since it is logistic regression, $x_1$ should only be linear in the log odds of $y$. I guess the $y$ axis would be the empirical log odds, obtained by binning $y$? That seems to me the only way to visually check for non-linearities. $\endgroup$ Commented Apr 26, 2020 at 22:22
  • $\begingroup$ One checks for nonlinearities by adding nonlinear terms to the model, fitting this extended model, and checking whether the improved fit is significant. $\endgroup$
    – whuber
    Commented Apr 27, 2020 at 13:00

0

Your Answer

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