# What does it mean to control for a variable?

Let's say I want to see the effect of having a pool on the price of properties in a city. What does it really mean to control for zipcodes?

And does this answer the crucial question that I want to include the effect of zipcodes into my analysis?

• In econometrics "to control" means "to account for". But I think a more elaborated answer exists. Commented Apr 23, 2022 at 4:17

## Summarised explanation:

Controlling for a variable essentially means you're measuring an independent variable and accounting for its presence to negate/remove its flow-on effects on other variables and the dependent variable (e.g. interaction effects, omitted variable bias, (multi-)colinearity etc.)

So when we control for zipcodes, we are taking actions in our statistical analysis (regression) to ensure that we factor in the direct and indirect effects of zipcodes in our statistical model to make it efficient and not result in incorrect readings due to statistical bias. To achieve this, we can use techniques such as but not limited to: multi-linear regression, interaction variables.

## Detailed explanation:

If your goal is to analyse the pure effect of having a pool installed at a property on its price, "controlling for" zipcodes would be to make sure that the impact of zipcodes (e.g. living in a rich or poor socio-economic area) doesn't influence the reading (co-efficient) for the variable we're looking to see the pure effect of (in this case, pools increasing house prices).

So in the case where you do a single variable analysis (a mono-linear/simple regression): [how does <hasPool> impact <housePrice>], the variable hasPool will have an inaccurate statistical significance and also an overstated effect value (the variable hasPool will incorporate other things such as the fact that "rich zipcodes have pools, rich zipcodes also increase house prices"). This situation is omitted variable bias (you've forgotten to factor in zipcodes and part of their effect is being read as being as a result of having a pool).

NB: This doesn't mean simple regressions are bad or useless. They're very helpful to quickly triage if a variable is worth considering into a model before committing to factoring it into the model. This is because it's quicker to to get a quick (but of course as noted above, very inprecise) look at the variable rather than immediately imputting into the model you are using which (if it has loads of data and many variables) could take ages to finish processing. However, you shouldn't be using a simple regression to find out the pure effect of an independent variable on its own - instead a multi-linear regression is more effective.

You could then do a multi-linear regression (analysis incorporating more than one variable) such as: [how do <hasPool> and <locatedInRichZipcode> impact <housePrice>]. The variables hasPool and locatedInRichZipcode are now both being factored into what causes increases in house price. hasPool is now more accurate, as the fact that the effect of being located in a rich zipcode is also being measured. However the co-linearity (high correlation between two variables) between having a pool and being in a rich zipcode increases the standard errors of the co-effecients, and thus could result in the variable being incorrectly found to be statistically insignificant, and also makes the pure effect of the variables measured blurred.

However, being in a rich zipcode and having a pool are closely related occurances, so we'd need to also incorporate an interaction variable hasPoolAndLocatedInRichZipcode to account for the venn-diagram "shared-zone" effect of having both a pool and being in a rich area: [how do <hasPool>, <locatedInRichZipCode>, and <hasPoolAndLocatedInRichZipcode> impact <housePrice>].

This is a more effective regression and though the statistical analysis improvements in "controlling" (i.e. taking into account) zipcodes and their effect, we are better able to approximate what the pure effect (co-efficient) of a variable such as having a pool is on house prices.