# Partial Regression

Learn how to understand holding everything else constant through partial regression.

## How do we understand holding everything else constant through partial regression?

The coefficient of an independent variable on the dependent variable is interpreted as the effect of the independent variable, while holding other variables in the model constant. We can understand the meaning of holding other variables constant via an example of partial regression.

Take the model used earlier as an example. We first regress logy on the other two independent variables loglab and logland, obtain the residual, and call ityres, which represents the component of logy unexplained by population and land area. Then, we regress open on the other two independent variables loglab and logland, obtain the residual, and call it openres, which represents the component of open unexplained by population and land area. Note how the option na.action = na.exclude is included the lm() function so that missing values are excluded rather than omitted. Without this option, an error message will be produced in including the residual and fitted value variables into the original dataset.

Next, when we regress yres on openres, we find that the coefficient of openres is the same as open in the original model (as well as other results).

Get hands-on with 1200+ tech skills courses.