Let’s practice with another variable: bedrooms. We’ll estimate a model of the following form. Think for a minute: what do you think the sign of each coefficient will be?
We should expect that \(\gamma_1>0\), since bigger houses should be more valuable.
We should also expect \(\gamma_2>0\), since houses with more bedrooms should also be more valuable.
Let’s estimate three models:
Code
r1 <-lm(price ~ sqft, ames)r2 <-lm(price ~ bedrooms, ames)r3 <-lm(price ~ sqft + bedrooms, ames)regz <-list(`Price`= r1,`Price`= r2,`Price`= r3)coefz <-c("sqft"="Square Footage","bedrooms"="Bedrooms","(Intercept)"="Constant")gofz <-c("nobs", "r.squared")modelsummary(regz,title ="Effect of Sq. Ft. and Bedrooms on Sale Price",estimate ="{estimate}{stars}",coef_map = coefz,gof_map = gofz)
Output
Effect of Sq. Ft. and Bedrooms on Sale Price
Price
Price
Price
Square Footage
111.694***
136.361***
(2.066)
(2.247)
Bedrooms
13889.495***
−29149.110***
(1765.042)
(1372.135)
Constant
13289.634***
141151.743***
59496.236***
(3269.703)
(5245.395)
(3741.249)
Num.Obs.
2930
2930
2930
R2
0.500
0.021
0.566
In the first model, we find that an increase in square footage increases price. In the second model, we find that an increase in bedrooms increases price, too. However, in the third model, we find:
Each additional square foot increases price by $136.36.
Each additional bedroom decreases price by $29,149.11.
Wait a minute… An extra bedroom decreases sale price? Initially, this might be confusing, so let’s think about this carefully. In words, this coefficient’s interpretation is:
Increasing the number of bedrooms by one, holding square footage constant, decreases sale price by $29,149.11.
What does it mean to increase the number of bedrooms in a property while holding square footage constant? Suppose a home is 2,000 square feet with four rooms. Each room is 500 square feet (on average). If we add an additional room, but do not change the square footage, each room would now only be 400 square feet (on average). Therefore, adding an extra bedroom, while holding square footage constant, makes for a bunch of small rooms. This is not something that is typically sought after in the housing market, hence the negative coefficient.
We can add more than just two variables to our model. Below is a progression of models that culminate in a model with three explanatory variables:
Interpreting these coefficients is similar to the case where you have only two explanatory variables.
Coefficient Interpretation for Model 3
A 1% increase in square footage, holding bedrooms and age constant, increases sale price by 0.875%.
An additional bedroom, holding age and square footage constant, reduces sale price by 8.2%.
An additional year of age, holding square footage and bedrooms constant, reduces sale price by 0.6%.
Evaluating \(R^2\)
Something else to note is how the \(R^2\) changes from model to model as we add explanatory/control variables. Each new control variable adds a little bit more information, which improves the model’s ability to explain. As a way to visualize this, we can plot the fitted values against the true, observed values. Since all three models have log(price) as the outcome, both axes are in log(price). If the model was perfect at explaining prices, all of the points would fall on the red 45°, \(y = x\) line.
As control variables are included, the \(R^2\) increases and the points start to get tighter to the diagonal line. This means that the predicted values are getting closer to the actual values.
A note about \(R^2\)
You should not choose which variables are (or are not) important based on changes in \(R^2\). Technically, it is impossible for \(R^2\) to decrease after you add another variable. Of course, variables that add a lot of explanatory power to your model should be considered, but \(R^2\) does not tell you which model is best. As we will see later, there are trade-offs faced when including/excluding variables, so you should rely on theory and intuition to guide your modeling decisions.
Points that are above the 45° line are expected to have higher sale prices than what they actually sold for. Points below the line sold for higher prices than what the model predicted.