a2s
pdf
keyboard_arrow_up
School
The Chinese University of Hong Kong *
*We aren’t endorsed by this school
Course
4020
Subject
Industrial Engineering
Date
Nov 24, 2024
Type
Pages
2
Uploaded by nkc.alanng529
MGEC11, Assignment 2 Suggested Solutions
Yue Yu
Fall 2023
Q1
(i)
library
(wooldridge)
data
(
hprice1
)
names
(hprice1)
##
[1] "price"
"assess"
"bdrms"
"lotsize"
"sqrft"
"colonial"
##
[7] "lprice"
"lassess"
"llotsize" "lsqrft"
(ii)
q1.ols1
<-
lm
(price
~
sqrft
+
bdrms,
data=
hprice1)
summary
( q1.ols1 )
##
## Call:
## lm(formula = price ~ sqrft + bdrms, data = hprice1)
##
## Residuals:
##
Min
1Q
Median
3Q
Max
## -127.627
-42.876
-7.051
32.589
229.003
##
## Coefficients:
##
Estimate Std. Error t value Pr(>|t|)
## (Intercept) -19.31500
31.04662
-0.622
0.536
## sqrft
0.12844
0.01382
9.291 1.39e-14 ***
## bdrms
15.19819
9.48352
1.603
0.113
## ---
## Signif. codes:
0
***
0.001
**
0.01
*
0.05
.
0.1
1
##
## Residual standard error: 63.04 on 85 degrees of freedom
## Multiple R-squared:
0.6319, Adjusted R-squared:
0.6233
## F-statistic: 72.96 on 2 and 85 DF,
p-value: < 2.2e-16
(iii)
Holding square footage constant, the estimated increase in price for a house with two more bedrooms is
$30,396 (=15.198x2x1000). Note that the unit of price is thousand dollars.
1
(iv)
The estimated increase in price for a house with an additional 50 square footage is $6,422, (=0.12844x50x1000),
holding the number of bedrooms constant.
(v)
Based on R-squared, 63% of the variation in price is explained by square footage and number of bedrooms.
(vi)
phat
=
q1.ols1
$
coefficients[
1
]
+
q1.ols1
$
coefficients[
2
]
*
2076
+
q1.ols1
$
coefficients[
3
]
*
3
phat
## (Intercept)
##
292.9131
The predicted selling price is $292,913.
(vii)
The residual for this house is $77,087. Because the predicted price is lower than the actual price, it suggests
that the buyer overpaid for the house.
presi
=
370
-
phat
presi
## (Intercept)
##
77.08685
2
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help