[Stata Program]
input p s be ba new
48.5 1.10 3 1 0
55.0 1.01 3 2 0
68.0 1.45 3 2 0
137.0 2.40 3 3 0
309.4 3.30 4 3 1
17.5 .40 1 1 0
19.6 1.28 3 1 0
24.5 .74 3 1 0
34.8 .78 2 1 0
32.0 .97 3 1 0
28.0 .84 3 1 0
49.9 1.08 2 2 0
59.9 .99 2 1 0
61.5 1.01 3 2 0
60.0 1.34 3 2 0
65.9 1.22 3 1 0
67.9 1.28 3 2 0
68.9 1.29 3 2 0
69.9 1.52 3 2 0
70.5 1.25 3 2 0
72.9 1.28 3 2 0
72.5 1.28 3 1 0
72.0 1.36 3 2 0
71.0 1.20 3 2 0
76.0 1.46 3 2 0
72.9 1.56 4 2 0
73.0 1.22 3 2 0
70.0 1.40 2 2 0
76.0 1.15 2 2 0
69.0 1.74 3 2 0
75.5 1.62 3 2 0
76.0 1.66 3 2 0
81.8 1.33 3 2 0
84.5 1.34 3 2 0
83.5 1.40 3 2 0
86.0 1.15 2 2 1
86.9 1.58 3 2 1
86.9 1.58 3 2 1
86.9 1.58 3 2 1
87.9 1.71 3 2 0
88.1 2.10 3 2 0
85.9 1.27 3 2 0
89.5 1.34 3 2 0
87.4 1.25 3 2 0
87.9 1.68 3 2 0
88.0 1.55 3 2 0
90.0 1.55 3 2 0
96.0 1.36 3 2 1
99.9 1.51 3 2 1
95.5 1.54 3 2 1
98.5 1.51 3 2 0
100.1 1.85 3 2 0
99.9 1.62 4 2 1
101.9 1.40 3 2 1
101.9 1.92 4 2 0
102.3 1.42 3 2 1
110.8 1.56 3 2 1
105.0 1.43 3 2 1
97.9 2.00 3 2 0
106.3 1.45 3 2 1
106.5 1.65 3 2 0
116.0 1.72 4 2 1
108.0 1.79 4 2 1
107.5 1.85 3 2 0
109.9 2.06 4 2 1
110.0 1.76 4 2 0
120.0 1.62 3 2 1
115.0 1.80 4 2 1
113.4 1.98 3 2 0
114.9 1.57 3 2 0
115.0 2.19 3 2 0
115.0 2.07 4 2 0
117.9 1.99 4 2 0
110.0 1.55 3 2 0
115.0 1.67 3 2 0
124.0 2.40 4 2 0
129.9 1.79 4 2 1
124.0 1.89 3 2 0
128.0 1.88 3 2 1
132.4 2.00 4 2 1
139.3 2.05 4 2 1
139.3 2.00 4 2 1
139.7 2.03 3 2 1
142.0 2.12 3 3 0
141.3 2.08 4 2 1
147.5 2.19 4 2 0
142.5 2.40 4 2 0
148.0 2.40 5 2 0
149.0 3.05 4 2 0
150.0 2.04 3 3 0
172.9 2.25 4 2 1
190.0 2.57 4 3 1
280.0 3.85 4 3 0
end
label variable p "selling price in thousands"
label variable s "size in thousands"
label variable be "number bedrooms"
label variable ba "number bathrooms"
label variable new "new-1 or old-0"
summarize s ba p
corr s ba p
stem s
stem ba
stem p
graph p s ba, matrix half
regress p s ba, beta
pcorr p ba s
rvfplot
rvpplot s
rvpplot ba
vif
collin p s ba /* user written program: findit collin */
predict sresid, rstandard
sort sresid
list p s ba sresid in 1/10
list p s ba sresid in -10/l
summarize sresid, detail
stem sresid
pnorm sresid
qnorm sresid
regress p s
regress p s ba
regress p ba
regress p s ba be
test be
sw regress p s ba be, pe(.05)
[Stata Output]
label variable p "selling price in thousands"
label variable s "size in thousands"
label variable be "number bedrooms"
label variable ba "number bathrooms"
label variable new "new-1 or old-0"
summarize s ba p
Variable | Obs Mean Std. Dev. Min Max
---------+-----------------------------------------------------
s | 93 1.649677 .5252607 .4 3.85
ba | 93 1.956989 .4147807 1 3
p | 93 99.53333 44.18413 17.5 309.4
corr s ba p
(obs=93)
| s ba p
---------+---------------------------
s | 1.0000
ba | 0.6625 1.0000
p | 0.8988 0.7137 1.0000
stem s
Stem-and-leaf plot for s (size in thousands)
s rounded to nearest multiple of .01
plot in units of .01
0** | 40
0** | 74,78
0** | 84,97,99
1** | 01,01,08,10,15,15
1** | 20,22,22,25,25,27,28,28,28,28,29,33,34,34,34,36,36
1** | 40,40,40,42,43,45,45,46,51,51,52,54,55,55,55,56,56,57,58,58,58
1** | 62,62,62,65,66,67,68,71,72,74,76,79,79
1** | 80,85,85,88,89,92,98,99
2** | 00,00,00,03,04,05,06,07,08,10,12,19,19
2** | 25
2** | 40,40,40,40,57
2** |
2** |
3** | 05
3** | 30
3** |
3** |
3** | 85
stem ba
Stem-and-leaf plot for ba (number bathrooms)
0* | 1111111111
0* | 222222222222222222222222222222222222222222222222222222222222222 ... (77)
0* | 333333
stem p
Stem-and-leaf plot for p (selling price in thousands)
p rounded to integers
0** | 18
0** | 20,25,28,32,35
0** | 49,50,55
0** | 60,60,62,66,68,68,69,69,70,70,71,71,72,73,73,73,73,76,76,76,76
0** | 82,84,85,86,86,87,87,87,87,88,88,88,88,90,90,96,96,98,99
1** | 00,00,00,02,02,02,05,06,07,08,08,10,10,10,11,13,15,15,15,15,15,16,18
1** | 20,24,24,28,30,32,37,39,39
1** | 40,41,42,43,48,48,49,50
1** | 73
1** | 90
2** |
2** |
2** |
2** |
2** | 80
3** | 09
graph p s ba,matrix half
regress p s ba, beta
Source | SS df MS Number of obs = 93
---------+------------------------------ F( 2, 90) = 224.11
Model | 149573.054 2 74786.527 Prob > F = 0.0000
Residual | 30032.8082 90 333.697869 R-squared = 0.8328
---------+------------------------------ Adj R-squared = 0.8291
Total | 179605.862 92 1952.23763 Root MSE = 18.267
------------------------------------------------------------------------------
p | Coef. Std. Err. t P>|t| Beta
---------+--------------------------------------------------------------------
s | 63.86315 4.840401 13.194 0.000 .7592047
ba | 22.44845 6.129679 3.662 0.000 .2107359
_cons | -49.75164 9.183284 -5.418 0.000 .
------------------------------------------------------------------------------
pcorr p ba s
(obs=93)
Partial correlation of p with
Variable | Corr. Sig.
-------------+------------------
ba | 0.3601 0.000
s | 0.8119 0.000
rvfplot, yline(0)
rvpplot s, yline(0)
rvpplot ba, yline(0)
vif
Variable | VIF 1/VIF
---------+----------------------
ba | 1.78 0.561117
s | 1.78 0.561117
---------+----------------------
Mean VIF | 1.78
collin p s ba
Collinearity Diagnostics
SQRT Cond R-
Variable VIF VIF Tolerance Eigenval Index Squared
------------------------------------------------------------------------
s 1.78 1.33 0.5611 1.6625 1.0000 0.4389
ba 1.78 1.33 0.5611 0.3375 2.2194 0.4389
------------------------------------------------------------------------
Mean VIF 1.78 Condition Number 2.2194
Determinant of correlation matrix 0.5611
predict sresid,rstandard
sort sresid
list p s ba sresid in 1/10
p s ba sresid
1. 149 3.05 2 -2.41815
2. 88.1 2.1 2 -2.279348
3. 69 1.74 2 -2.051483
4. 19.6 1.28 1 -1.990447
5. 137 2.4 3 -1.933392
6. 76 1.66 2 -1.384791
7. 97.9 2 2 -1.379334
8. 124 2.4 2 -1.368973
9. 75.5 1.62 2 -1.271868
10. 69.9 1.52 2 -1.229592
list p s ba sresid in -10/l
p s ba sresid
84. 105 1.43 2 1.022334
85. 106.3 1.45 2 1.023229
86. 72.5 1.28 1 1.031645
87. 114.9 1.57 2 1.073262
88. 17.5 .4 1 1.10068
89. 129.9 1.79 2 1.125482
90. 120 1.62 2 1.17789
91. 59.9 .99 1 1.361192
92. 172.9 2.25 2 1.896437
93. 309.4 3.3 3 4.734716
summarize sresid, detail
Standardized residuals
-------------------------------------------------------------
Percentiles Smallest
1% -2.41815 -2.41815
5% -1.933392 -2.279348
10% -1.229592 -2.051483 Obs 93
25% -.6306399 -1.990447 Sum of Wgt. 93
50% .0940549 Mean .0024452
Largest Std. Dev. 1.020772
75% .7050466 1.17789
90% 1.022334 1.361192 Variance 1.041976
95% 1.125482 1.896437 Skewness .6291919
99% 4.734716 4.734716 Kurtosis 6.807695
stem sresid
Stem-and-leaf plot for sresid (Studentized residuals)
sresid rounded to nearest multiple of .01
plot in units of .01
sresid rounded to nearest multiple of .01
plot in units of .01
-2** | 42,28,05
-1** | 99,93
-1** | 38,38,37,27,23,20,15,11,09
-0** | 93,91,87,80,80,79,73,68,68,63,55,50,50,50,50
-0** | 48,45,34,33,32,26,25,24,23,22,15,08,06,04,02
0** | 00,07,09,09,10,11,12,14,21,26,27,32,33,38,41,45,46,47,49
0** | 53,53,61,69,69,70,71,73,73,74,77,82,87,87,88,91,91,96,97
1** | 01,02,02,03,07,10,13,18,36
1** | 90
2** |
2** |
3** |
3** |
4** |
4** | 73
qnorm sresid
qnorm sresid
regress p s
Source | SS df MS Number of obs = 93
---------+------------------------------ F( 1, 91) = 382.63
Model | 145097.459 1 145097.459 Prob > F = 0.0000
Residual | 34508.4029 91 379.213218 R-squared = 0.8079
---------+------------------------------ Adj R-squared = 0.8058
Total | 179605.862 92 1952.23763 Root MSE = 19.473
------------------------------------------------------------------------------
p | Coef. Std. Err. t P>|t| [95% Conf. Interval]
---------+--------------------------------------------------------------------
s | 75.60684 3.865208 19.561 0.000 67.92908 83.2846
_cons | -25.19356 6.68845 -3.767 0.000 -38.47935 -11.90778
------------------------------------------------------------------------------
regress p s ba
Source | SS df MS Number of obs = 93
---------+------------------------------ F( 2, 90) = 224.11
Model | 149573.054 2 74786.527 Prob > F = 0.0000
Residual | 30032.8082 90 333.697869 R-squared = 0.8328
---------+------------------------------ Adj R-squared = 0.8291
Total | 179605.862 92 1952.23763 Root MSE = 18.267
------------------------------------------------------------------------------
p | Coef. Std. Err. t P>|t| [95% Conf. Interval]
---------+--------------------------------------------------------------------
s | 63.86315 4.840401 13.194 0.000 54.24685 73.47945
ba | 22.44845 6.129679 3.662 0.000 10.27078 34.62613
_cons | -49.75164 9.183284 -5.418 0.000 -67.99584 -31.50744
------------------------------------------------------------------------------
regress p ba
Source | SS df MS Number of obs = 93
---------+------------------------------ F( 1, 91) = 94.47
Model | 91484.3965 1 91484.3965 Prob > F = 0.0000
Residual | 88121.4656 91 968.367754 R-squared = 0.5094
---------+------------------------------ Adj R-squared = 0.5040
Total | 179605.862 92 1952.23763 Root MSE = 31.119
------------------------------------------------------------------------------
p | Coef. Std. Err. t P>|t| [95% Conf. Interval]
---------+--------------------------------------------------------------------
ba | 76.02581 7.821818 9.720 0.000 60.48873 91.5629
_cons | -49.24837 15.64364 -3.148 0.002 -80.32253 -18.17421
------------------------------------------------------------------------------
regress p s ba be
Source | SS df MS Number of obs = 93
-------------+------------------------------ F( 3, 89) = 148.03
Model | 149621.203 3 49873.7345 Prob > F = 0.0000
Residual | 29984.6586 89 336.906277 R-squared = 0.8331
-------------+------------------------------ Adj R-squared = 0.8274
Total | 179605.862 92 1952.23763 Root MSE = 18.355
------------------------------------------------------------------------------
p | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
s | 62.35406 6.292024 9.91 0.000 49.85194 74.85617
ba | 22.91549 6.281753 3.65 0.000 10.43378 35.3972
be | 1.63579 4.326989 0.38 0.706 -6.961846 10.23343
_cons | -53.38249 13.31866 -4.01 0.000 -79.84638 -26.91861
------------------------------------------------------------------------------
test be
( 1) be = 0.0
F( 1, 89) = 0.14
Prob > F = 0.7063
sw regress p s ba be, pe(.05)
begin with empty model
p = 0.0000 < 0.0500 adding s
p = 0.0004 < 0.0500 adding ba
Source | SS df MS Number of obs = 93
-------------+------------------------------ F( 2, 90) = 224.11
Model | 149573.054 2 74786.527 Prob > F = 0.0000
Residual | 30032.8082 90 333.697869 R-squared = 0.8328
-------------+------------------------------ Adj R-squared = 0.8291
Total | 179605.862 92 1952.23763 Root MSE = 18.267
------------------------------------------------------------------------------
p | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
s | 63.86315 4.840401 13.19 0.000 54.24685 73.47945
ba | 22.44845 6.129679 3.66 0.000 10.27078 34.62613
_cons | -49.75164 9.183284 -5.42 0.000 -67.99584 -31.50744
------------------------------------------------------------------------------