Ames, Iowa Real Estate Price Predictions

Darwhin Gomez

What factors drive sale price?

Buying or selling a home can be very stressful to experienced buyers and sellers. Sometimes even browsing online can become incredibly frustrating. Two similar homes can vary in price significantly and many times the reasons are not clear.


Lets try to make sense of what factors are actually affecting a home’s price.

Intuition Size, Neighborhood

Neighborhoods

Sale price mean (red line) of data = 180921.2 

Modeling

As we can see, sale prices vary due to a number of factors. But how can we get a holistic, weighted representation of how these factors influence the sale price? One way is to model it. We can use a regression model to predict house prices and then extract the contributing factors and their impact on the model.

Linear Regression – to understand linear relationships between features and sale price. The model uses 59 predictors.

SalePrice ~ Id + MSSubClass + MSZoning + LotFrontage + LotArea + 
    LotShape + LandContour + LotConfig + LandSlope + Neighborhood + 
    Condition1 + Condition2 + BldgType + HouseStyle + OverallQual + 
    OverallCond + YearBuilt + YearRemodAdd + RoofStyle + RoofMatl + 
    Exterior1st + Exterior2nd + MasVnrArea + ExterQual + ExterCond + 
    Foundation + BsmtFinSF1 + BsmtFinSF2 + BsmtUnfSF + TotalBsmtSF + 
    HeatingQC + Electrical + X1stFlrSF + X2ndFlrSF + LowQualFinSF + 
    GrLivArea + BsmtFullBath + BsmtHalfBath + FullBath + HalfBath + 
    BedroomAbvGr + KitchenAbvGr + KitchenQual + TotRmsAbvGrd + 
    Functional + Fireplaces + GarageYrBlt + GarageCars + GarageArea + 
    WoodDeckSF + OpenPorchSF + EnclosedPorch + X3SsnPorch + ScreenPorch + 
    PoolArea + MiscVal + MoSold + YrSold + SaleType + SaleCondition

Call:
lm(formula = SalePrice ~ ., data = train_data)

Residuals:
    Min      1Q  Median      3Q     Max 
-105676  -10396       0    9420  148320 

Coefficients: (2 not defined because of singularities)
                       Estimate Std. Error t value Pr(>|t|)    
(Intercept)          -8.240e+05  1.428e+06  -0.577 0.564059    
Id                    1.764e+00  2.190e+00   0.805 0.420971    
MSSubClass            8.530e+01  1.319e+02   0.647 0.517934    
MSZoningFV            2.839e+04  1.553e+04   1.828 0.067966 .  
MSZoningRH            3.936e+04  1.623e+04   2.425 0.015584 *  
MSZoningRL            2.883e+04  1.386e+04   2.080 0.037895 *  
MSZoningRM            2.412e+04  1.293e+04   1.865 0.062592 .  
LotFrontage           2.717e+01  6.131e+01   0.443 0.657821    
LotArea               1.729e+00  3.167e-01   5.459 6.76e-08 ***
LotShapeIR2          -1.751e+03  5.983e+03  -0.293 0.769882    
LotShapeIR3           6.487e+03  1.289e+04   0.503 0.615012    
LotShapeReg          -1.317e+03  2.360e+03  -0.558 0.577020    
LandContourHLS        1.378e+04  7.278e+03   1.894 0.058656 .  
LandContourLow       -1.599e+04  1.071e+04  -1.493 0.135920    
LandContourLvl        3.483e+03  5.617e+03   0.620 0.535380    
LotConfigCulDSac      9.435e+03  5.666e+03   1.665 0.096332 .  
LotConfigFR2         -7.637e+03  6.165e+03  -1.239 0.215858    
LotConfigFR3         -9.755e+03  1.437e+04  -0.679 0.497583    
LotConfigInside      -1.985e+02  2.556e+03  -0.078 0.938132    
LandSlopeMod          9.081e+03  5.356e+03   1.695 0.090453 .  
LandSlopeSev         -8.330e+04  2.235e+04  -3.727 0.000211 ***
NeighborhoodBlueste   9.184e+03  2.023e+04   0.454 0.649944    
NeighborhoodBrDale    1.924e+04  1.386e+04   1.388 0.165615    
NeighborhoodBrkSide   1.482e+04  1.277e+04   1.160 0.246264    
NeighborhoodClearCr  -1.096e+04  1.398e+04  -0.784 0.433189    
NeighborhoodCollgCr  -5.723e+03  9.110e+03  -0.628 0.530031    
NeighborhoodCrawfor   1.603e+04  1.109e+04   1.445 0.148799    
NeighborhoodEdwards  -9.072e+03  1.017e+04  -0.892 0.372777    
NeighborhoodGilbert  -1.399e+04  1.020e+04  -1.372 0.170646    
NeighborhoodIDOTRR    1.195e+04  1.527e+04   0.783 0.434179    
NeighborhoodMeadowV   1.563e+04  1.550e+04   1.008 0.313660    
NeighborhoodMitchel  -1.567e+04  1.083e+04  -1.447 0.148320    
NeighborhoodNAmes    -7.468e+03  1.000e+04  -0.747 0.455455    
NeighborhoodNoRidge   1.041e+04  1.090e+04   0.956 0.339592    
NeighborhoodNPkVill   5.318e+03  2.537e+04   0.210 0.834026    
NeighborhoodNridgHt   1.468e+04  8.913e+03   1.647 0.100054    
NeighborhoodNWAmes   -2.088e+04  1.067e+04  -1.957 0.050819 .  
NeighborhoodOldTown   4.900e+02  1.284e+04   0.038 0.969581    
NeighborhoodSawyer   -1.225e+03  1.071e+04  -0.114 0.908973    
NeighborhoodSawyerW  -1.375e+03  1.008e+04  -0.136 0.891548    
NeighborhoodSomerst   9.827e+03  1.065e+04   0.923 0.356577    
NeighborhoodStoneBr   4.482e+04  1.100e+04   4.074 5.18e-05 ***
NeighborhoodSWISU     2.063e+03  1.257e+04   0.164 0.869668    
NeighborhoodTimber   -1.317e+04  1.076e+04  -1.224 0.221347    
NeighborhoodVeenker  -5.384e+03  1.582e+04  -0.340 0.733669    
Condition1Feedr      -4.124e+03  6.728e+03  -0.613 0.540092    
Condition1Norm        9.227e+03  5.181e+03   1.781 0.075381 .  
Condition1PosA        4.317e+03  1.679e+04   0.257 0.797191    
Condition1PosN       -1.074e+03  1.299e+04  -0.083 0.934117    
Condition1RRAe       -1.493e+04  1.133e+04  -1.318 0.187929    
Condition1RRAn        1.655e+03  8.745e+03   0.189 0.849965    
Condition1RRNe        2.747e+03  2.477e+04   0.111 0.911749    
Condition1RRNn       -1.618e+04  1.792e+04  -0.903 0.367006    
Condition2Feedr       8.159e+02  3.453e+04   0.024 0.981157    
Condition2Norm        9.581e+03  2.937e+04   0.326 0.744317    
Condition2PosA        2.755e+04  5.039e+04   0.547 0.584837    
Condition2PosN       -4.649e+04  4.059e+04  -1.146 0.252386    
BldgType2fmCon       -1.354e+04  1.856e+04  -0.730 0.465924    
BldgTypeDuplex       -1.315e+04  1.186e+04  -1.109 0.267843    
BldgTypeTwnhs        -3.348e+04  1.516e+04  -2.208 0.027579 *  
BldgTypeTwnhsE       -2.671e+04  1.430e+04  -1.867 0.062342 .  
HouseStyle1.5Unf      1.455e+04  1.231e+04   1.182 0.237642    
HouseStyle1Story      1.676e+04  6.122e+03   2.738 0.006340 ** 
HouseStyle2.5Fin     -4.227e+04  1.718e+04  -2.461 0.014114 *  
HouseStyle2.5Unf     -2.614e+04  1.260e+04  -2.075 0.038373 *  
HouseStyle2Story     -3.083e+03  4.900e+03  -0.629 0.529513    
HouseStyleSFoyer      1.067e+04  8.620e+03   1.238 0.216099    
HouseStyleSLvl        6.578e+03  7.877e+03   0.835 0.403975    
OverallQual           8.506e+03  1.435e+03   5.929 4.91e-09 ***
OverallCond           7.081e+03  1.261e+03   5.615 2.89e-08 ***
YearBuilt             3.417e+02  1.135e+02   3.010 0.002709 ** 
YearRemodAdd          1.145e+02  8.147e+01   1.406 0.160196    
RoofStyleGable        4.026e+04  2.845e+04   1.415 0.157558    
RoofStyleGambrel      3.771e+04  3.036e+04   1.242 0.214613    
RoofStyleHip          3.670e+04  2.851e+04   1.287 0.198525    
RoofStyleMansard      5.427e+04  3.210e+04   1.691 0.091354 .  
RoofMatlMembran       1.584e+05  4.373e+04   3.621 0.000316 ***
RoofMatlRoll         -2.566e+03  2.726e+04  -0.094 0.925037    
RoofMatlTar&Grv       2.424e+04  2.521e+04   0.961 0.336784    
RoofMatlWdShake      -2.398e+04  2.566e+04  -0.934 0.350402    
RoofMatlWdShngl       6.379e+04  1.324e+04   4.818 1.80e-06 ***
Exterior1stBrkComm   -2.767e+04  3.693e+04  -0.749 0.454039    
Exterior1stBrkFace   -4.554e+02  1.509e+04  -0.030 0.975933    
Exterior1stCemntBd   -4.994e+04  3.409e+04  -1.465 0.143399    
Exterior1stHdBoard   -1.265e+04  1.571e+04  -0.806 0.420705    
Exterior1stImStucc   -3.893e+04  3.094e+04  -1.258 0.208765    
Exterior1stMetalSd   -5.856e+03  1.814e+04  -0.323 0.746941    
Exterior1stPlywood   -1.726e+04  1.596e+04  -1.082 0.279762    
Exterior1stStone     -5.172e+04  3.335e+04  -1.551 0.121431    
Exterior1stStucco    -1.783e+04  1.682e+04  -1.060 0.289367    
Exterior1stVinylSd   -1.533e+04  1.605e+04  -0.955 0.339923    
Exterior1stWd Sdng   -1.997e+04  1.496e+04  -1.336 0.182156    
Exterior1stWdShing   -5.319e+03  1.590e+04  -0.334 0.738133    
Exterior2ndAsphShn    1.221e+04  2.553e+04   0.478 0.632604    
Exterior2ndBrk Cmn    3.019e+04  3.045e+04   0.991 0.321833    
Exterior2ndBrkFace    7.428e+03  1.552e+04   0.479 0.632337    
Exterior2ndCmentBd    4.638e+04  3.375e+04   1.374 0.169857    
Exterior2ndHdBoard    8.093e+03  1.505e+04   0.538 0.590819    
Exterior2ndImStucc    1.431e+04  1.833e+04   0.781 0.435251    
Exterior2ndMetalSd    7.156e+03  1.753e+04   0.408 0.683255    
Exterior2ndOther     -2.519e+04  2.964e+04  -0.850 0.395641    
Exterior2ndPlywood    5.921e+03  1.451e+04   0.408 0.683245    
Exterior2ndStone      2.126e+04  2.077e+04   1.024 0.306376    
Exterior2ndStucco     9.946e+03  1.564e+04   0.636 0.525152    
Exterior2ndVinylSd    1.351e+04  1.547e+04   0.873 0.383006    
Exterior2ndWd Sdng    1.763e+04  1.403e+04   1.256 0.209495    
Exterior2ndWd Shng    4.407e+03  1.474e+04   0.299 0.764975    
MasVnrArea            2.841e+01  6.784e+00   4.187 3.20e-05 ***
ExterQualFa          -1.263e+04  1.630e+04  -0.775 0.438620    
ExterQualGd          -3.465e+04  6.321e+03  -5.482 5.97e-08 ***
ExterQualTA          -3.423e+04  7.282e+03  -4.701 3.14e-06 ***
ExterCondFa           2.197e+03  2.724e+04   0.081 0.935751    
ExterCondGd          -3.417e+03  2.622e+04  -0.130 0.896371    
ExterCondTA          -1.945e+03  2.617e+04  -0.074 0.940777    
FoundationCBlock      4.822e+03  4.387e+03   1.099 0.272161    
FoundationPConc       5.646e+03  4.812e+03   1.173 0.241083    
FoundationSlab        1.978e+04  1.044e+04   1.895 0.058525 .  
FoundationStone       1.886e+04  1.622e+04   1.163 0.245115    
FoundationWood       -3.894e+04  1.969e+04  -1.977 0.048404 *  
BsmtFinSF1            4.176e+01  5.806e+00   7.191 1.73e-12 ***
BsmtFinSF2            2.947e+01  7.478e+00   3.941 8.99e-05 ***
BsmtUnfSF             1.655e+01  5.417e+00   3.055 0.002337 ** 
TotalBsmtSF                  NA         NA      NA       NA    
HeatingQCFa           1.948e+03  7.145e+03   0.273 0.785237    
HeatingQCGd          -3.171e+03  2.942e+03  -1.078 0.281450    
HeatingQCPo           1.353e+03  3.038e+04   0.045 0.964483    
HeatingQCTA          -4.524e+03  2.893e+03  -1.563 0.118418    
ElectricalFuseF       8.728e+03  7.961e+03   1.096 0.273337    
ElectricalFuseP      -4.012e+04  3.396e+04  -1.181 0.237971    
ElectricalMix         2.685e+04  3.116e+04   0.862 0.389195    
ElectricalSBrkr       8.846e+02  4.110e+03   0.215 0.829637    
X1stFlrSF             6.098e+01  7.631e+00   7.992 5.90e-15 ***
X2ndFlrSF             7.893e+01  7.313e+00  10.793  < 2e-16 ***
LowQualFinSF          8.852e+01  3.087e+01   2.867 0.004273 ** 
GrLivArea                    NA         NA      NA       NA    
BsmtFullBath          1.619e+03  2.613e+03   0.620 0.535753    
BsmtHalfBath          2.730e+03  4.186e+03   0.652 0.514562    
FullBath              3.116e+03  3.083e+03   1.011 0.312506    
HalfBath             -4.122e+03  2.981e+03  -1.383 0.167171    
BedroomAbvGr         -7.461e+03  1.882e+03  -3.965 8.15e-05 ***
KitchenAbvGr         -1.464e+04  9.035e+03  -1.621 0.105516    
KitchenQualFa        -1.180e+04  9.021e+03  -1.308 0.191447    
KitchenQualGd        -2.335e+04  4.338e+03  -5.383 1.02e-07 ***
KitchenQualTA        -2.108e+04  5.185e+03  -4.066 5.35e-05 ***
TotRmsAbvGrd          1.004e+03  1.303e+03   0.770 0.441415    
FunctionalMaj2       -2.736e+04  1.904e+04  -1.437 0.151072    
FunctionalMin1       -1.228e+04  1.209e+04  -1.016 0.309791    
FunctionalMin2       -5.099e+03  1.211e+04  -0.421 0.673815    
FunctionalMod        -2.140e+04  1.359e+04  -1.574 0.115912    
FunctionalTyp         2.317e+03  1.035e+04   0.224 0.823026    
Fireplaces            1.941e+03  1.944e+03   0.998 0.318578    
GarageYrBlt           1.366e+02  8.379e+01   1.630 0.103613    
GarageCars            6.132e+03  2.956e+03   2.074 0.038458 *  
GarageArea            2.617e+00  1.043e+01   0.251 0.801894    
WoodDeckSF            1.022e+01  8.339e+00   1.226 0.220691    
OpenPorchSF           2.826e+01  1.681e+01   1.681 0.093172 .  
EnclosedPorch         1.559e+01  1.807e+01   0.862 0.388750    
X3SsnPorch            4.304e+01  3.568e+01   1.206 0.228106    
ScreenPorch           3.910e+01  1.665e+01   2.349 0.019130 *  
PoolArea             -5.012e+00  3.254e+01  -0.154 0.877651    
MiscVal              -3.475e+00  6.273e+00  -0.554 0.579795    
MoSold               -9.337e+02  3.407e+02  -2.740 0.006303 ** 
YrSold               -2.188e+02  7.105e+02  -0.308 0.758223    
SaleTypeCon           4.834e+04  2.811e+04   1.719 0.086020 .  
SaleTypeConLD        -1.054e+04  1.364e+04  -0.773 0.439852    
SaleTypeConLI         5.644e+02  1.593e+04   0.035 0.971753    
SaleTypeConLw         3.163e+03  1.574e+04   0.201 0.840788    
SaleTypeCWD           1.508e+04  1.582e+04   0.953 0.340900    
SaleTypeNew          -2.561e+03  1.828e+04  -0.140 0.888598    
SaleTypeOth           3.292e+04  2.444e+04   1.347 0.178466    
SaleTypeWD           -5.162e+03  5.883e+03  -0.877 0.380540    
SaleConditionAdjLand  2.946e+04  2.630e+04   1.120 0.263008    
SaleConditionAlloca   9.006e+03  1.191e+04   0.756 0.449964    
SaleConditionFamily   4.548e+03  8.073e+03   0.563 0.573391    
SaleConditionNormal   7.142e+03  4.138e+03   1.726 0.084859 .  
SaleConditionPartial  2.156e+04  1.744e+04   1.236 0.216830    
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 23240 on 664 degrees of freedom
  (259 observations deleted due to missingness)
Multiple R-squared:  0.9406,    Adjusted R-squared:  0.9251 
F-statistic: 60.73 on 173 and 664 DF,  p-value: < 2.2e-16
[1] " Train Rsquared"
[1] 0.9405563
[1] "Test Rsquared"
[1] 0.7471636
[1] "Test RMSE"
[1] 38826.67

Extracted Significant Features

Model Residuals

Predictions

Predictions Other Significant Features

The Roof

Takeaways

  • Price is directly impacted by square footage, homes with more livable square footage tend to sell higher.

  • Price can vary significantly by neighborhood.

  • Better overall quality homes sell at higher prices even for comparable Lot sizes.

  • Building Materials for the roof have a significant impact on sale price.

Data Code

  • Data : https://jse.amstat.org/v19n3/decock.pdf

  • Code_Github

  • ** The Model trained here did not incorporate all original predictors, predictors with non factor levels, and exactly correlated predictors like GrLivArea. Also visualizations show model predictions on 75/25 split not the entire data set.


    Thanks