Homework 1
#Excercise 1 (C1, Ch03 - Wooldridge)
A problem of interest to health officials (and others) is to determine the effects of smoking during pregnancy on infant health. One measure of infant health is birth weight; a birth weight that is too low can put an infant at risk for contracting various illnesses. Since factors other than cigarette smoking that affect birth weight are likely to be correlated with smoking (cigs), we should take those factors into account. For example, higher income (faminc) generally results in access to better prenatal care, as well as better nutrition for the mother. An equation that recognizes this is:
bwght=b0+b1cigs+b2faminc+u
What is the most likely sign for b2?
Positive, because, we except that higher income increase the weight of the baby
Do yo think cigs and faminc are likely to be correlated? Explain why the correlation might be positive or negative.
There may be a positive relation, because, a family with higher incomes, have the economic opportunity to buy cigs, with more frecuency than a family with a low incomes.
The changes in beta of cigs is really small, this means that cigars and faminc, are no correlacted.
library(wooldridge)
data("bwght")
modelxd=lm(bwght~cigs,data=bwght)
summary(modelxd)
##
## Call:
## lm(formula = bwght ~ cigs, data = bwght)
##
## Residuals:
## Min 1Q Median 3Q Max
## -96.772 -11.772 0.297 13.228 151.228
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 119.77190 0.57234 209.267 < 2e-16 ***
## cigs -0.51377 0.09049 -5.678 1.66e-08 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 20.13 on 1386 degrees of freedom
## Multiple R-squared: 0.02273, Adjusted R-squared: 0.02202
## F-statistic: 32.24 on 1 and 1386 DF, p-value: 1.662e-08
include faminc
modelxd=lm(bwght~cigs+faminc,data=bwght)
summary(modelxd)
##
## Call:
## lm(formula = bwght ~ cigs + faminc, data = bwght)
##
## Residuals:
## Min 1Q Median 3Q Max
## -96.061 -11.543 0.638 13.126 150.083
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 116.97413 1.04898 111.512 < 2e-16 ***
## cigs -0.46341 0.09158 -5.060 4.75e-07 ***
## faminc 0.09276 0.02919 3.178 0.00151 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 20.06 on 1385 degrees of freedom
## Multiple R-squared: 0.0298, Adjusted R-squared: 0.0284
## F-statistic: 21.27 on 2 and 1385 DF, p-value: 7.942e-10
#Excercise 2 (C2, Ch03 - Wooldridge)
Use the data in HPRICE1 to estimate the model
price=b0+b1sqrft+b2bdrms+u
where price is the house price measured in thousands of dollars.
i.Write out the results in equation form
library(wooldridge)
data("hprice1")
modeldt=lm(price~sqrft+bdrms,data=hprice1)
modeldt
##
## Call:
## lm(formula = price ~ sqrft + bdrms, data = hprice1)
##
## Coefficients:
## (Intercept) sqrft bdrms
## -19.3150 0.1284 15.1982
What is the estimated increase in price for a house with one more bedroom, holding square footage constant? $ 15,198.19
What is the estimated increase in price for a house with an additional bedroom that is 140 square feet in size? Compare this to your answer in part (ii).
(0.1284*140)+(1*15.1982)
## [1] 33.1742
The change in price is 33174.2 dollars
predict(modeldt,data.frame(sqrft=2438,bdrms=4))
## 1
## 354.6052
300-354.6052
## [1] -54.6052
The buyer underpaid.