0% found this document useful (0 votes)
28 views5 pages

Stata

The document analyzes housing data using regression analysis in Stata. It runs single-variable and multi-variable regressions with housing Price as the dependent variable and variables like number of bedrooms, size of house, distance from city center, and number of baths as independent variables. It provides outputs of the regressions including coefficients, p-values, R-squared values, and interpretations of the results.

Uploaded by

Halima
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views5 pages

Stata

The document analyzes housing data using regression analysis in Stata. It runs single-variable and multi-variable regressions with housing Price as the dependent variable and variables like number of bedrooms, size of house, distance from city center, and number of baths as independent variables. It provides outputs of the regressions including coefficients, p-values, R-squared values, and interpretations of the results.

Uploaded by

Halima
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Stata Assignment 3 (Solution)

. corr Price Bedrooms Size Baths Distance


(obs=105)

| Price Bedrooms Size Baths Distance


-------------+---------------------------------------------
Price | 1.0000
Bedrooms | 0.4674 1.0000
Size | 0.3710 0.3835 1.0000
Baths | 0.3822 0.3289 0.0244 1.0000
Distance | -0.3470 -0.1534 -0.1172 -0.1950 1.0000

. regress Price Bedrooms Size Distance Baths

Source | SS df MS Number of obs = 105


-------------+---------------------------------- F(4, 100) = 15.59
Model | 88622.4936 4 22155.6234 Prob > F = 0.0000
Residual | 142145.096 100 1421.45096 R-squared = 0.3840
-------------+---------------------------------- Adj R-squared = 0.3594
Total | 230767.589 104 2218.91913 Root MSE = 37.702

------------------------------------------------------------------------------
Price | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
Bedrooms | 8.139059 2.844057 2.86 0.005 2.49653 13.78159
Size | .0451595 .016266 2.78 0.007 .0128882 .0774307
Distance | -2.235848 .7797184 -2.87 0.005 -3.782787 -.6889085
Baths | 29.46958 10.16755 2.90 0.005 9.297464 49.64171
_cons | 61.1308 43.78826 1.40 0.166 -25.74385 148.0054
------------------------------------------------------------------------------

. regress Price Bedrooms Distance Baths

Source | SS df MS Number of obs = 105


-------------+---------------------------------- F(3, 101) = 17.08
Model | 77666.0582 3 25888.6861 Prob > F = 0.0000
Residual | 153101.531 101 1515.85674 R-squared = 0.3366
-------------+---------------------------------- Adj R-squared = 0.3168
Total | 230767.589 104 2218.91913 Root MSE = 38.934

------------------------------------------------------------------------------
Price | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
Bedrooms | 11.22657 2.703144 4.15 0.000 5.86426 16.58888
Distance | -2.416877 .8023743 -3.01 0.003 -4.008572 -.8251826
Baths | 25.84504 10.41284 2.48 0.015 5.188758 46.50132
_cons | 160.0151 26.3045 6.08 0.000 107.834 212.1961
------------------------------------------------------------------------------

. regress Price Size


Source | SS df MS Number of obs = 105
-------------+---------------------------------- F(1, 103) = 16.44
Model | 31770.2044 1 31770.2044 Prob > F = 0.0001
Residual | 198997.385 103 1932.01344 R-squared = 0.1377
-------------+---------------------------------- Adj R-squared = 0.1293
Total | 230767.589 104 2218.91913 Root MSE = 43.955

------------------------------------------------------------------------------
Price | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
Size | .0702892 .0173334 4.06 0.000 .0359125 .1046659
_cons | 64.79312 38.7841 1.67 0.098 -12.12599 141.7122
------------------------------------------------------------------------------

. regress Price Bedrooms

Source | SS df MS Number of obs = 105


-------------+---------------------------------- F(1, 103) = 28.79
Model | 50409.1862 1 50409.1862 Prob > F = 0.0000
Residual | 180358.403 103 1751.05246 R-squared = 0.2184
-------------+---------------------------------- Adj R-squared = 0.2109
Total | 230767.589 104 2218.91913 Root MSE = 41.846

------------------------------------------------------------------------------
Price | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
Bedrooms | 14.6523 2.730867 5.37 0.000 9.236269 20.06833
_cons | 165.4241 11.1519 14.83 0.000 143.3069 187.5413
------------------------------------------------------------------------------

. regress Price Distance

Source | SS df MS Number of obs = 105


-------------+---------------------------------- F(1, 103) = 14.10
Model | 27791.4863 1 27791.4863 Prob > F = 0.0003
Residual | 202976.103 103 1970.64178 R-squared = 0.1204
-------------+---------------------------------- Adj R-squared = 0.1119
Total | 230767.589 104 2218.91913 Root MSE = 44.392

------------------------------------------------------------------------------
Price | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
Distance | -3.353993 .8931207 -3.76 0.000 -5.125288 -1.582699
_cons | 270.167 13.7646 19.63 0.000 242.8681 297.4658
------------------------------------------------------------------------------

. regress Price Baths

Source | SS df MS Number of obs = 105


-------------+---------------------------------- F(1, 103) = 17.62
Model | 33704.9628 1 33704.9628 Prob > F = 0.0001
Residual | 197062.626 103 1913.22938 R-squared = 0.1461
-------------+---------------------------------- Adj R-squared = 0.1378
Total | 230767.589 104 2218.91913 Root MSE = 43.74

------------------------------------------------------------------------------
Price | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
Baths | 45.80875 10.91403 4.20 0.000 24.16335 67.45414
_cons | 125.777 23.10923 5.44 0.000 79.94533 171.6087
------------------------------------------------------------------------------

. corr Price Bedrooms


(obs=105)

| Price Bedrooms
-------------+------------------
Price | 1.0000
Bedrooms | 0.4674 1.0000

. corr Price Size


(obs=105)

| Price Size
-------------+------------------
Price | 1.0000
Size | 0.3710 1.0000

. corr Price Distance


(obs=105)

| Price Distance
-------------+------------------
Price | 1.0000
Distance | -0.3470 1.0000

. corr Baths
(obs=105)

| Baths
-------------+---------
Baths | 1.0000

. exit, clear

Interpretation:

a. Regression Equations: (SINGLE VARIABLE)


· Price with no. of bedrooms: P= 165.4241 + 14.6523B
Explanation:
1) R-squared is not greater than 0.5, which means it is not a good model.
2) The p value is 0 which is less than 0.05 and so it is a significant variable.
3) SS model is not greater than SS residual so this is not a good model.

· Price with size of the house: P= 64.7932 + 0.0702S


Explanation:

1) R-squared is not greater than 0.5, which means it is not a good model.
2) The p value is 0 which is less than 0.05 and so it is a significant variable.
3) SS model is greater than SS residual so this is a good model.

· Price with center of the city: P= 270.167 – 3.3539D


Explanation:
1) R-squared is not greater than 0.5, which means it is not a good model.
2) The p value is 0 which is less than 0.05 and so it is a significant variable.
3) SS model is not greater than SS residual so this is not a good model.

· Price with no. of bathrooms: P= 125.777 + 45.8075BT

Explanation:
1) R-squared is not greater than 0.5, which means it is not a good model.
2) The p value is 0 which is less than 0.05 and so it is a significant variable.
3) SS model is not greater than SS residual so this is not a good model.

Multi Variable Regression Equation

P= 61.1308 + 29.4965BA – 2.2358D + 0.0515S + 8.1390B

b. The intercept is 61.1308.

c. Bedroom: It is moderately positively correlated as it has value closer to 0.5.


Size: : It is also moderately positively correlated as it has value closer to 0.5.
Distance: : It is moderately negatively correlated as it has value closer to -0.5.
Baths: : It is moderately positively correlated as it has value closer to 0.5.

d. Yes, Pool is the dummy variable given in the data set as when you see the data on data browser,
you can clearly see that it is the only variable with values 0 and 1 which are the only values a
dummy variable can take.

e. No, all the variables in the data are significant and none of them need to be deleted.
f. All the variables in this case are significant i.e. Bedrooms, baths, distance and size.

You might also like