# How to “statistically adjust” for variables? [duplicate]

This question already has an answer here:

I've been trying to understand what means "statistically adjusted" when comparing two variables. For example, when computing the odds ratio for a death after surgery in two hospitals, we compute the odds of death in one hospital, to the odds of death in the other hospital.

But, then let's say we want to "statistically adjust" (as the literature likes to call it) for other variables. For each variable we "statistically adjust" for, we will multiply the number of odds ratios by 2.

For example, we "statistically adjust" for whether or not the patients are healthy. This would mean that we would have two odds ratios:

• odds ratio for the patients in good health
• odds ratio for patients of poor health

Then lets say we adjust for patients of age >50 and patients of age < 50. Then, we have a total of 4 odds ratios, which is the cartesian product of age, and health.

How do I end up with one odds ratio comparing death rates in the two hospitals?

A resource that attempts to explain this is here: https://www.iwh.on.ca/wrmb/statistically-adjusted. It says that a statistician "will tell you that the odds ratio has been statistically adjusted to incorporate the effect of patient condition at the time of surgery, and is now 1.14". I do not understand how one value, 1.14, is able to summarize everything about multiple odds ratios. Thanks for helping me.

## marked as duplicate by Silverfish, Wayne, Peter Flom - Reinstate Monica♦Mar 13 '16 at 2:17

When you "statistically adjust" something, what you are really doing is removing the effect of whatever you are adjusting for. Formally, the things you are adjusting for are called "covariates", which is just the set of variables that (a) you did not experimentally control and (b) have in impact on the outcome.

Not surprisingly, these things pop up a lot in observational studies, where you want to measure X (say, spending on beer) as a function of Y (say, age), but cannot set up a formal experiment. A naive approach to my example of studying age and beer expenditures would simply select a random sample of the population and regress beer spending on age.

However: what other things affect beer purchase patterns? Is it the only factor influencing beer expenditures? Off the top of my head, I'd expect that some other factors that would be influencing the outcome would be:

1. College student or not
2. Race/ethnicity
3. Religion (e.g. Mormons don't drink)
4. Income (positively correlated with age, until about 65)

So, let's say your naive regression shows a strong, positive effect of age on beer expenditures. However, what if your random sample contains a large number of young frat boys (who never pay for the copious beer they drink) while also having a large number of rich, elderly persons.

A critic of your study would say that age has no intrinsic effect, it's all income and the availability of alternative beer sources. To counter, you would adjust for the effect of these "covariates" on beer expenditures by including these variables as explanatory variables in your regression model. After you do that, the coefficient/weight applied to the age factor better represents the differential impact of age (ceteris paribus).

It may turn out that after including income and availability, the residual variability left for age to explain is minuscule, in which case your thesis is in trouble.

So, the bottom line is that statistically "adjusting" doesn't mean applying some fudge factor, it means that you've included explanatory variables in your model that are in some sense "ancillary" to your study's purpose (but nonetheless are important for accurately measuring your target effect). Fitting a statistical model with extra variables will spread the observed variability among these variables.

There are a few ways that adjustments can be done but one of the most common ways when there are multiple variables to adjust for is to simply include, as independent variables into a model, the variables for which you want to adjust.

So for example, let's say you wanted to compare the odds of death for hospital A and hospital B, adjusting for patient age (in years) and severity of illness measured (for simplification) as "minor" or "extreme." Then you could simply fit the following logistic regression model:

$log[p/(1-p)]=\beta_0+\beta_1X_1+\beta_2X_2+\beta_3X_3$

where $p=P(Y=1|X_1, X_2, X_3)$, $y= 0, 1$ is the indicator variable for death and $X_1=1$ for hospital A or 0 for hospital B, $X_2$ is the patient's age in years, and $X_3=1$ for minor severity of illness, 0 otherwise. With this model you can calculate the odds of death in hospital A compared to hospital B, adjusted for the other variables included in the model by simply exponentiating the the estimated coefficient corresponding to the hospital indicator variable you obtain from your logistic regression model, in this case, $exp(\hat{\beta}_1)$.

If you didn't want to use logistic regression for this, you can still use a tabular approach. The method for obtaining the adjusted odds ratio is called the Mantel-Haenszel adjusted odds ratio. This is simply a weighted average of the individual odds ratios obtained in each of the tables obtained by stratifying on the confounder (in your linked example the odds ratios formed from the individual odds ratio from the good health table and poor health table). The weight for each table is equal to the inverse of the estimated variance of the odds ratio for the table. The general formula is given by:

$\sum_i a_id_i/n_i\over{\sum_i b_ic_i/n_i}$

for each table $i$, where, in this example, $a_i$ is the number of deaths in hospital B, $d_i$ is the number of living in hospital A, $b_i$ is the number of deaths in hospital A and $c_i$ is the number living in hospital B. Taking the numbers from this example we have, letting table $i=1$ for those in good health and $i=2$ for poor health:

$\sum_i^2 a_id_i/n_i\over{\sum_i^2 b_ic_i/n_i}$=$(8)(594)/1200+(8)(1433)/1700\over{(6)(592)/1200+(57)(192)/1700}$=$1.138958\approx1.14$

• Okay, I understand. so, the hospital becomes an indicator variable. Now, perhaps you understand my confusion in this example, where they claim to compute an odds ratio without fitting a model: "will tell you that the odds ratio has been statistically adjusted to incorporate the effect of patient condition at the time of surgery, and is now 1.14". – Sother Mar 11 '16 at 7:59
• @Sother, I edited my answer to include the answer to your follow-up question. – StatsStudent Mar 11 '16 at 10:51
• @Sother, If you found this acceptable, please click the green checkmark. Thanks. – StatsStudent Mar 12 '16 at 20:12
• OK, thanks a lot for your explanation. I understand that we have to compute some kind of weighted average, but the formula you use somehow doesn't make complete sense to me. I would have thought a representative value would be a weighted average of the odds ratios, weighted by the number of people: The odds ratios for good and poor health, respectively, are 1.3/1 and 4/3.8, so OR = ((1.3*1200)+(4/3.8)*1700)/(1200+1700). Is there anything wrong with this formulation? – Sother Mar 12 '16 at 20:19
• @Sother, the weights are chosen so to be the inverse of the variance of the odds ratio. That way tables with smaller variances are given more weight compared to those with larger variances. Simply weighting by the number of people in the table isn't providing you with better estimates if the variance in higher in those tables with more people. See the original paper for a derivation of the MH statistic: (see here under Articles (methods): medicine.mcgill.ca/epidemiology/hanley/c634/stratified – StatsStudent Mar 14 '16 at 6:00