Строим модели, включая новые переменные

Строим регрессию по всем факторам

. reg priceperm totsp livesp kitsp dist metrdist walk brick tel bal floor new floors nfloor floor1 floor2 sw w nw

note: floor1 omitted because of collinearity

priceperm Coef. Std. Err. t P>t [95% Conf. Interval]
           
totsp -23.83594 8.222067 -2.90 0.004 -39.97708 -7.694796
livesp 2.229188 11.62848 0.19 0.848 -20.59924 25.05762
kitsp 120.9425 22.36393 5.41 0.000 77.03878 164.8462
dist -114.3117 6.939782 -16.47 0.000 -127.9356 -100.6879
metrdist -31.75717 5.466021 -5.81 0.000 -42.48779 -21.02656
walk 512.4305 50.0966 10.23 0.000 414.0834 610.7776
brick 241.3125 56.45363 4.27 0.000 130.4856 352.1394
tel 131.6624 64.80613 2.03 0.043 4.438296 258.8865
bal -58.10572 68.42888 -0.85 0.396 -192.4418 76.23037
floor 504.257 89.0837 5.66 0.000 329.3724 679.1416
new -382.2859 157.241 -2.43 0.015 -690.9735 -73.59829
floors 43.17511 6.588258 6.55 0.000 30.24137 56.10884
nfloor 21.12263 6.87479 3.07 0.002 7.626393 34.61887
floor1 (omitted)        
floor2 193.6415 121.1757 1.60 0.110 -44.24439 431.5274
sw 220.4716 69.50931 3.17 0.002 84.01449 356.9288
w -15.53594 69.18949 -0.22 0.822 -151.3652 120.2933
nw (omitted)        
_cons 5688.65 239.3413 23.77 0.000 5218.787 6158.513
           

note: nw omitted because of collinearity

 

Source | SS df MS Number of obs = 763

-------------+------------------------------ F( 16, 746) = 45.02

Model | 280918767 16 17557423 Prob > F = 0.0000

Residual | 290939912 746 389999.882 R-squared = 0.4912

-------------+------------------------------ Adj R-squared = 0.4803

Total | 571858679 762 750470.708 Root MSE = 624.5

 

Убираем из модели незначимые переменные

. reg priceperm totsp kitsp dist metrdist walk brick tel bal floor new floors nfloor floor1 floor2 sw w nw

note: floor1 omitted because of collinearity

note: nw omitted because of collinearity

Source SS df MS Number of obs = 763
    F( 15, 747) = 48.08  
Model 15 18726962.3 Prob > F = 0.0000
Residual 747 389496.98 R-squared = 0.4912
    Adj R-squared = 0.4810  
Total 762 750470.708 Root MSE = 624.1
         
priceperm Coef. Std. Err. t P>t [95% Conf. Interval]
           
totsp -22.63279 5.308048 -4.26 0.000 -33.05325 -12.21232
kitsp 119.9648 21.76058 5.51 0.000 77.24564 162.684
dist -114.3706 6.92851 -16.51 0.000 -127.9723 -100.7689
metrdist -31.74165 5.461896 -5.81 0.000 -42.46414 -21.01916
walk 512.3406 50.0621 10.23 0.000 414.0614 610.6197
brick 240.2024 56.11963 4.28 0.000 130.0314 350.3733
tel 131.0143 64.67614 2.03 0.043 4.045638 257.9829
bal -58.17913 68.38367 -0.85 0.395 -192.4262 76.06792
floor 503.1923 88.85308 5.66 0.000 328.7609 677.6238
new -385.053 156.4761 -2.46 0.014 -692.2383 -77.86774
floors 43.03555 6.543687 6.58 0.000 30.18934 55.88175
nfloor 21.04038 6.856964 3.07 0.002 7.579171 34.5016
floor1 (omitted)        
floor2 193.2616 121.0813 1.60 0.111 -44.43857 430.9617
sw 220.4665 69.46448 3.17 0.002 84.09768 356.8353
w -15.43383 69.14281 -0.22 0.823 -151.1712 120.3035
nw (omitted)        
_cons 5708.533 215.5608 26.48 0.000 5285.356 6131.71
           

. reg priceperm totsp kitsp dist metrdist walk brick tel bal floor new floors nfloor floor2 sw

Source SS df MS Number of obs = 763
    F( 14, 748) = 51.58  
Model 14 20063216.3 Prob > F = 0.0000
Residual 748 389002.207 R-squared = 0.4912
    Adj R-squared = 0.4817  
Total 762 750470.708 Root MSE = 623.7
         
priceperm Coef. Std. Err. t P>t [95% Conf. Interval]
           
totsp -22.64478 5.304404 -4.27 0.000 -33.05807 -12.23149
kitsp 120.0053 21.746 5.52 0.000 77.31483 162.6958
dist -113.9993 6.721552 -16.96 0.000 -127.1946 -100.8039
metrdist -31.794 5.453392 -5.83 0.000 -42.49977 -21.08823
walk 512.5497 50.02153 10.25 0.000 414.3504 610.749
brick 241.6689 55.69832 4.34 0.000 132.3253 351.0125
tel 131.0826 64.63432 2.03 0.043 4.196389 257.9689
bal -58.05207 68.33786 -0.85 0.396 -192.2089 76.10474
floor 501.937 88.6186 5.66 0.000 327.9663 675.9078
new -384.8134 156.373 -2.46 0.014 -691.7956 -77.83121
floors 42.86903 6.496896 6.60 0.000 30.11471 55.62335
nfloor 21.0565 6.852228 3.07 0.002 7.604613 34.50839
floor2 192.429 120.9469 1.59 0.112 -45.00689 429.8648
sw 231.6783 47.95305 4.83 0.000 137.5397 325.8169
_cons 5695.598 207.4935 27.45 0.000 5288.259 6102.937
           

. reg priceperm totsp kitsp dist metrdist walk brick tel floor new floors nfloor floor2 sw

Source SS df MS Number of obs = 763
    F( 13, 749) = 55.51  
Model 13 21584947.2 Prob > F = 0.0000
Residual 749 388857.631 R-squared = 0.4907
    Adj R-squared = 0.4818  
Total 762 750470.708 Root MSE = 623.58
         
priceperm Coef. Std. Err. t P>t [95% Conf. Interval]
           
totsp -22.59862 5.30314 -4.26 0.000 -33.0094 -12.18783
kitsp 119.6491 21.73792 5.50 0.000 76.97455 162.3235
dist -113.8151 6.716805 -16.94 0.000 -127.0011 -100.6291
metrdist -31.72283 5.451735 -5.82 0.000 -42.42532 -21.02033
walk 513.9156 49.98639 10.28 0.000 415.7855 612.0457
brick 241.5738 55.68785 4.34 0.000 132.251 350.8967
tel 129.9915 64.60955 2.01 0.045 3.154135 256.8288
floor 462.8857 75.74849 6.11 0.000 314.1811 611.5903
new -391.6494 156.1368 -2.51 0.012 -698.1672 -85.13158
floors 42.22122 6.450787 6.55 0.000 29.55745 54.88499
nfloor 20.87844 6.847748 3.05 0.002 7.435375 34.3215
floor2 149.2331 109.7179 1.36 0.174 -66.15818 364.6243
sw 231.8342 47.94379 4.84 0.000 137.714 325.9544
_cons 5691.661 207.4032 27.44 0.000 5284.5 6098.822

. reg priceperm totsp kitsp dist metrdist walk brick tel floor new floors nfloor sw

Source SS df MS Number of obs = 763
    F( 12, 750) = 59.91  
Model 12 23323743.5 Prob > F = 0.0000
Residual 750 389298.343 R-squared = 0.4894
    Adj R-squared = 0.4813  
Total 762 750470.708 Root MSE = 623.94
         
priceperm Coef. Std. Err. t P>t [95% Conf. Interval]
           
totsp -22.14878 5.295816 -4.18 0.000 -32.54517 -11.7524
kitsp 117.0832 21.66818 5.40 0.000 74.54572 159.6207
dist -112.9848 6.692801 -16.88 0.000 -126.1237 -99.84598
metrdist -31.68811 5.454763 -5.81 0.000 -42.39653 -20.97969
walk 512.5983 50.00532 10.25 0.000 414.4313 610.7654
brick 244.0884 55.68869 4.38 0.000 134.7642 353.4127
tel 131.2453 64.63957 2.03 0.043 4.349287 258.1413
floor 391.6417 54.75053 7.15 0.000 284.1592 499.1242
new -403.7455 155.9716 -2.59 0.010 -709.9384 -97.55256
floors 40.00396 6.244949 6.41 0.000 27.7443 52.26362
nfloor 25.84808 5.794812 4.46 0.000 14.4721 37.22406
sw 234.2453 47.93815 4.89 0.000 140.1364 328.3543
_cons 5744.119 203.9011 28.17 0.000 5343.834 6144.404
           

 

Описательные данные

. sum

Variable Obs Mean Std. Dev. Min Max
           
price 277400.7 59191.17
totsp 50.69528 7.042669
livesp 30.62726 3.590044
kitsp 8.130799 1.855631
dist 11.87169 3.733502 3.5 20.5
           
metrdist 9.406291 4.406219
walk .6330275 .4822951
brick .3591088 .4800538
tel .8558322 .3514902
bal .7758847 .4172719
           
floor .757536 .4288546
new .0222805 .147691
floors 11.90826 5.466382
nfloor 6.165138 4.53554
floor1 .1310616 .3376891
           
floor2 .1114024 .3148361
sw .3748362 .4843981
w .4665793 .499209
nw .1585845 .3655278
h13 .0445609 .2064731
           
f13 .0353866 .1848762
h7 .0629096 .2429595
f7 .0576671 .2332658
h3 .0707733 .2566139
f3 .0629096 .2429595
           
priceperm 5469.564 866.2971 3514.118 7966.089

 

Добавляем логарифмы значимых переменных

. gen lnpriceperm=ln(priceperm)

. gen lntotsp=ln(totsp)

. gen lnkitsp=ln(kitsp)

. gen lndist=ln(dist)

. gen lnmetrdist=ln(metrdist)

. gen lnfloors=ln(floors)

. gen lnnfloor=ln(nfloor)

Строим логарифмическую модель

. reg lnpriceperm lntotsp lnkitsp lndist lnmetrdist lnfloors lnnfloor walk brick tel floor new sw

Source SS df MS Number of obs = 763
    F( 12, 750) = 58.59  
Model 9.11274569 12 .759395474 Prob > F = 0.0000
Residual 9.7214236 750 .012961898 R-squared = 0.4838
    Adj R-squared = 0.4756  
Total 18.8341693 762 .024716758 Root MSE = .11385
         
lnpriceperm Coef. Std. Err. t P>t [95% Conf. Interval]
           
lntotsp -.1994131 .0491942 -4.05 0.000 -.2959878 -.1028384
lnkitsp .1488611 .0338481 4.40 0.000 .0824127 .2153094
lndist -.2114004 .0131866 -16.03 0.000 -.2372874 -.1855133
lnmetrdist -.038846 .008135 -4.78 0.000 -.0548159 -.022876
lnfloors .0979816 .0127182 7.70 0.000 .0730141 .122949
lnnfloor .0251988 .005752 4.38 0.000 .0139068 .0364908
walk .0992604 .0090582 10.96 0.000 .0814781 .1170428
brick .055766 .0103708 5.38 0.000 .0354067 .0761253
tel .0268293 .0117936 2.27 0.023 .003677 .0499817
floor .0569536 .0105399 5.40 0.000 .0362624 .0776448
new -.0656276 .0283623 -2.31 0.021 -.1213065 -.0099488
sw .0445313 .0087298 5.10 0.000 .0273935 .0616691
_cons 9.227774 .1493441 61.79 0.000 8.934591 9.520956
           

 

Делаем РЕ-тест МакКиннона

. predict priceperm_hat

(option xb assumed; fitted values)

. g lg_priceperm_hat=log(priceperm_hat)

. predict lgpriceperm_hat

(option xb assumed; fitted values)

. g exp_lnpriceperm_hat=exp(lgpriceperm_hat)

Добавляем переменные для двух моделей, чтобы понять уровень значимости необъяснённых данных в каждой из моделей

. . g d_lnpriceperm_hat= lg_priceperm_hat- lgpriceperm_hat

. . g d_priceperm_hat= priceperm_hat- exp_lnpriceperm_hat

Строим модели, включая новые переменные

. . reg lnpriceperm totsp kitsp dist metrdist walk brick tel floor new floors nfloor sw d_priceperm_hat

Source SS df MS Number of obs = 763
    F( 13, 749) = 56.78  
Model 9.34801688 13 .719078222 Prob > F = 0.0000
Residual 9.48615241 749 .01266509 R-squared = 0.4963
    Adj R-squared = 0.4876  
Total 18.8341693 762 .024716758 Root MSE = .11254
         
lnpriceperm Coef. Std. Err. t P>t [95% Conf. Interval]
           
totsp -.0040325 .0009567 -4.22 0.000 -.0059106 -.0021545
kitsp .0211111 .0039226 5.38 0.000 .0134104 .0288117
dist -.0205492 .0012446 -16.51 0.000 -.0229925 -.0181058
metrdist -.0062592 .0010011 -6.25 0.000 -.0082246 -.0042939
walk .0945092 .0090207 10.48 0.000 .0768004 .1122179
brick .0431358 .0100682 4.28 0.000 .0233706 .062901
tel .0234605 .0117022 2.00 0.045 .0004875 .0464334
floor .0740622 .0099061 7.48 0.000 .0546151 .0935092
new -.0720445 .0281432 -2.56 0.011 -.1272934 -.0167956
floors .0073291 .0011264 6.51 0.000 .0051178 .0095404
nfloor .0044789 .0010529 4.25 0.000 .0024119 .0065458
sw .0430066 .0086524 4.97 0.000 .0260209 .0599924
d_priceper~t -.0000824 .0000996 -0.83 0.408 -.000278 .0001131
_cons 8.652102 .0370245 233.69 0.000 8.579418 8.724786
           
           

. . reg priceperm totsp kitsp dist metrdist walk brick tel floor new floors nfloor sw d_lnpriceperm_hat

Source SS df MS Number of obs = 763
    F( 13, 749) = 56.41  
Model 13 21761615.9 Prob > F = 0.0000
Residual 749 385791.286 R-squared = 0.4947
    Adj R-squared = 0.4859  
Total 762 750470.708 Root MSE = 621.12
         
priceperm Coef. Std. Err. t P>t [95% Conf. Interval]
           
totsp -23.3354 5.288962 -4.41 0.000 -33.71835 -12.95245
kitsp 123.0898 21.67707 5.68 0.000 80.53472 165.6448
dist -117.8863 6.889341 -17.11 0.000 -131.411 -104.3616
metrdist -29.3464 5.494344 -5.34 0.000 -40.13254 -18.56025
walk 516.8712 49.80302 10.38 0.000 419.1011 614.6413
brick 234.4734 55.54383 4.22 0.000 125.4333 343.5135
tel 147.1764 64.59951 2.28 0.023 20.35872 273.994
floor 382.1324 54.60936 7.00 0.000 274.9268 489.338
new -416.482 155.3343 -2.68 0.007 -721.4244 -111.5396
floors 40.33897 6.217911 6.49 0.000 28.13236 52.54558
nfloor 27.59376 5.802338 4.76 0.000 16.20298 38.98454
sw 237.472 47.73568 4.97 0.000 143.7603 331.1836
d_lnpricep~t -7856.148 2809.727 -2.80 0.005 -13372.02 -2340.271
_cons 5818.423 204.7128 28.42 0.000 5416.544 6220.302