# Logistic Regression: Risk Ratio and Interpreting the Magnitude of Confounding

Let's say I have a treatment and a test group, and I am trying to interpret the magnitude of confounding variables using logistic regression.

From my understanding, to do so I need 1) the crude risk ratio ($$RR_{crude}$$), which from my understanding is the risk ratio of the regression model without the confounding variable(s) added to the model and 2) the adjusted risk ratio ($$RR_{adjusted}$$), which from my understanding is the risk ratio of the regression model with the confounding variable(s) added to the model.

With this information, if I want to get the magnitude of confounding I can use the following equation - source:

$$magnitude of confounding =\frac{RR_{crude} - RR_{adjusted}}{RR_{crude}}$$

Now here are my questions:

• How do I calculate RR, and is my interpretation of crude and adjusted RR correct (additionally is there a way to calculate RR in Python using scipy or statsmodel) - i.e. I do understand how to calculate Odds Ratios.
• Is the way to calculate the magnitude of confounding above correct?
• How do I interpret the magnitude of confounding? Does it give me an indication as to by what percentage I need to adjust the results of my treatment group to take into account the effect of confounding variables (i.e. if I have a conversion rate on my treatment group of 9% and the magnitude of confounding, is 0.05, does it mean I need to reduce the conversion rate of my treatment group by 5% to take into account the influence of confounding variables?

If you already have a valid* logistic multiple regression model that includes confounders, there might not be much sense in trying to evaluate a numeric value of confounding magnitude. As the source you cite states under the heading "Summary of Control of Confounding," multiple regression analysis itself "provide[s] a way of adjusting for confounding in the analysis, provided one has information on the status of the confounding factors in the study subjects."

Thus you can evaluate the log-odds, odds, or probability of the outcome with a logistic regression model for any specified values of confounders or treatment group. So to answer your last point, the logistic regression provides an estimate of the treatment coefficient that directly takes into account confounders, and I don't see that you would otherwise need to take into account the information provided by a measure of magnitude of confounding.

If you do want to calculate a risk ratio (RR), relationships between the RR and the odds ratios or coefficients of a logistic regression model are shown in this question and answer. I have adapted slightly the form used by AdamO in that answer, to illustrate a crude RR ($$RR_{NC}$$) for a model including no confounders, only treatment $$T$$:

$$RR_{NC} = \frac{1 + \exp(-\beta_{0,NC})}{1+\exp(-\beta_{0,NC}-\beta_{T,NC})}$$

where $$\beta_{0,NC}$$ and $$\beta_{T,NC}$$ are respectively the intercept and the coefficient for treatment in that model omitting confounders. The extension to a model with values $$X_i$$ for a set of confounders $$C$$ could provide a type of adjusted RR:

$$RR = \frac{1 + \exp(-\beta_{0}-\sum_{i \in C}\beta_iX_i)}{1+\exp(-\beta_{0}-\beta_{T}-\sum_{i \in C}\beta_iX_i)}$$

but this RR, and thus your estimate of the magnitude of confounding, will depend on the specific confounder values chosen. I suppose you could choose to set all $$X_i$$ to 0 or some reference values, but what would that really mean? (And I'm not even going to get into the difficulty of determining confidence intervals for these RRs.)

As Frank Harrell put it in a comment on this question, "RRs are at odds with the logistic model (pun intended)." They don't add much useful if you have a valid logistic multiple regression model.

*This answer assumes that the logistic regression model is properly specified. Note that it might need to use transformations of continuous predictors to meet linearity requirements, include interaction terms of confounders with treatment status, etc.

• Thanks, that makes a lot of sense. – Teddy Jan 22 '20 at 16:59