** Multivariate Regression Demonstration: Housing Price Regressions ** ___ ____ ____ ____ ____ tm /__ / ____/ / ____/ ___/ / /___/ / /___/ 8.2 Copyright 1984-2005 Statistics/Data Analysis StataCorp 4905 Lakeway Drive College Station, Texas 77845 USA 800-STATA-PC http://www.stata.com 979-696-4600 stata@stata.com 979-696-4601 (fax) Single-user Stata for Windows perpetual license: Serial number: 1980531091 Licensed to: Eli Berman UC San Diego Notes: 1. (/m# option or -set memory-) 30.00 MB allocated to data . use "C:\work\120B\countyhousing.dta" . regress homeprice rent meaninc, robust Regression with robust standard errors Number of obs = 787 F( 2, 784) = 365.48 Prob > F = 0.0000 R-squared = 0.7442 Root MSE = 58641 ------------------------------------------------------------------------------ | Robust homeprice | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- rent | 533.8046 36.15888 14.76 0.000 462.8249 604.7843 meaninc | .7609347 .3308069 2.30 0.022 .1115625 1.410307 _cons | -233510.5 14240.27 -16.40 0.000 -261464 -205556.9 ------------------------------------------------------------------------------ . * Try the 3 step approach: . * First remove the effect of rent from homeprice: . regress homeprice rent, robust Regression with robust standard errors Number of obs = 787 F( 1, 785) = 680.19 Prob > F = 0.0000 R-squared = 0.7412 Root MSE = 58943 ------------------------------------------------------------------------------ | Robust homeprice | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- rent | 588.9613 22.58245 26.08 0.000 544.6322 633.2905 _cons | -225910.7 14374.09 -15.72 0.000 -254126.9 -197694.5 ------------------------------------------------------------------------------ . predict e_homeprice, residual . summ e* Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- e_homeprice | 787 .000051 58905.64 -175158.4 338358.4 . * Next, remove the predicted effect of rent from income . regress meaninc rent, robust Regression with robust standard errors Number of obs = 787 F( 1, 785) = 1041.16 Prob > F = 0.0000 R-squared = 0.6862 Root MSE = 8303 ------------------------------------------------------------------------------ | Robust meaninc | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- rent | 72.48552 2.246432 32.27 0.000 68.0758 76.89525 _cons | 9987.45 1415.721 7.05 0.000 7208.403 12766.5 ------------------------------------------------------------------------------ . predict e_meaninc, residual . summ e* Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- e_homeprice | 787 .000051 58905.64 -175158.4 338358.4 e_meaninc | 787 2.70e-06 8297.679 -25754.19 33570 . regress e_homeprice e_meaninc, robust Regression with robust standard errors Number of obs = 787 F( 1, 785) = 5.30 Prob > F = 0.0216 R-squared = 0.0115 Root MSE = 58604 ------------------------------------------------------------------------------ | Robust e_homeprice | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- e_meaninc | .7609346 .3305961 2.30 0.022 .1119776 1.409892 _cons | .0000489 2088.992 0.00 1.000 -4100.671 4100.671 ------------------------------------------------------------------------------ . gr7 e_homeprice e_meaninc, xlab ylab s([countyname]) . predict yhat, xb . * gr7 e_homeprice yhat e_meaninc, xlab ylab s([countyname]) c(.l) . sort e_meaninc . gr7 e_homeprice yhat e_meaninc, xlab ylab s([countyname]) c(.l) . regress homeprice e_meaninc, robust Regression with robust standard errors Number of obs = 787 F( 1, 785) = 1.23 Prob > F = 0.2681 R-squared = 0.0030 Root MSE = 1.2e+05 ------------------------------------------------------------------------------ | Robust homeprice | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- e_meaninc | .7609347 .6865593 1.11 0.268 -.5867748 2.108644 _cons | 177148.4 4124.256 42.95 0.000 169052.5 185244.3 ------------------------------------------------------------------------------ . gr7 homeprice e_meaninc, xlab ylab . generate lp=log(homeprice) . generate lr=log(rent) . summ l* Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- lp | 787 11.93748 .5077162 10.87993 13.67418 lr | 787 6.500126 .2356754 5.517453 7.239933 . gr7 lp lr, s([countyname]) . generate lincome=log(meaninc) . summ l* Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- lp | 787 11.93748 .5077162 10.87993 13.67418 lr | 787 6.500126 .2356754 5.517453 7.239933 lincome | 787 10.96699 .235739 9.818256 11.70568 . regress lp lr lincome, robust Regression with robust standard errors Number of obs = 787 F( 2, 784) = 460.12 Prob > F = 0.0000 R-squared = 0.7504 Root MSE = .25399 ------------------------------------------------------------------------------ | Robust lp | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- lr | 1.472332 .0973097 15.13 0.000 1.281313 1.66335 lincome | .4538609 .0952846 4.76 0.000 .2668179 .640904 _cons | -2.610353 .6843711 -3.81 0.000 -3.95377 -1.266937 ------------------------------------------------------------------------------ . display (1.47-1)/.097 4.8453608 . test lr=1 ( 1) lr = 1 F( 1, 784) = 23.56 Prob > F = 0.0000 . display 4.8453608^2 23.477521 . * 95% CI for the coefficient on rent is: . display 1.47+1.96*0.0973 1.660708 . display 1.47-1.96*0.0973 1.279292 . generate lpop=log(pop) . regress lp lr lincome lpop, robust Regression with robust standard errors Number of obs = 787 F( 3, 783) = 366.55 Prob > F = 0.0000 R-squared = 0.7525 Root MSE = .25305 ------------------------------------------------------------------------------ | Robust lp | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- lr | 1.412834 .1038725 13.60 0.000 1.208933 1.616736 lincome | .4545131 .094164 4.83 0.000 .2696693 .6393569 lpop | .0312154 .0150746 2.07 0.039 .0016239 .0608069 _cons | -2.60899 .6743682 -3.87 0.000 -3.932773 -1.285206 ------------------------------------------------------------------------------ . generate lunits=log(totalunits) . regress lp lr lincome lpop lunits, robust Regression with robust standard errors Number of obs = 787 F( 4, 782) = 353.68 Prob > F = 0.0000 R-squared = 0.7529 Root MSE = .25302 ------------------------------------------------------------------------------ | Robust lp | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- lr | 1.4151 .1030222 13.74 0.000 1.212867 1.617332 lincome | .4433079 .0970463 4.57 0.000 .2528059 .63381 lpop | .117919 .1163187 1.01 0.311 -.1104148 .3462528 lunits | -.0881807 .1130545 -0.78 0.436 -.3101068 .1337455 _cons | -2.556456 .6982409 -3.66 0.000 -3.927105 -1.185808 ------------------------------------------------------------------------------ . * test lpop lunits . test lpop lunits ( 1) lpop = 0 ( 2) lunits = 0 F( 2, 782) = 2.17 Prob > F = 0.1153