hw7solutions - Homework 7 Solutions Problem 1 realest <...

This preview shows page 1 - 3 out of 9 pages.

Homework 7 SolutionsProblem 1realest <-read.csv("realestate_sales.csv")realest <- realest[,2:9][5] (a)realfit <-lm(SalePrice ~ SqrFeet + Bedrooms,data =realest)summary(realfit)#### Call:## lm(formula = SalePrice ~ SqrFeet + Bedrooms, data = realest)#### Residuals:##Min1QMedian3QMax## -230.85-38.12-8.0325.40383.93#### Coefficients:##Estimate Std. Error t value Pr(>|t|)## (Intercept) -71.56033413.369303-5.3531.3e-07 ***## SqrFeet0.1641370.00582928.157< 2e-16 ***## Bedrooms-6.3603714.133096-1.5390.124## ---## Signif. codes:0***0.001**0.01*0.05.0.11#### Residual standard error: 78.19 on 518 degrees of freedom## Multiple R-squared:0.6784, Adjusted R-squared:0.6772## F-statistic: 546.4 on 2 and 518 DF,p-value: < 2.2e-16The estimates are:CoefficientValueβ0-71.560334β10.164137β2-6.360371When the number of bedrooms remains constant, we expect the sale price to increase by $0.164137 for everyadditional square foot of floor space. When the square footage remains constant, we expect the sale price todecrease by $6.360371 for every additional bathroom.[5] (b)confint(realfit,"SqrFeet")##2.5 %97.5 %1
## SqrFeet 0.1526848 0.1755892We are 95% confident that the sale price increases between $0.1526848 and $0.1755892 for every additionalsquare foot of floor space.[8] (c)We would have three predictors and one intercept, so the design matrix would be521×4.realfit2 <-lm(SalePrice ~ SqrFeet * Bedrooms,data =realest)summary(realfit2)#### Call:## lm(formula = SalePrice ~ SqrFeet * Bedrooms, data = realest)#### Residuals:##Min1QMedian3QMax## -194.26-41.44-5.8326.86378.58#### Coefficients:##Estimate Std. Error t value Pr(>|t|)## (Intercept)-2.093e+023.597e+01-5.818 1.04e-08 ***## SqrFeet2.269e-011.631e-0213.914< 2e-16 ***## Bedrooms3.022e+019.779e+003.0900.00211 **## SqrFeet:Bedrooms -1.591e-023.868e-03-4.114 4.52e-05 ***## ---## Signif. codes:0***0.001**0.01*0.05.0.11#### Residual standard error: 77.02 on 517 degrees of freedom## Multiple R-squared:0.6886, Adjusted R-squared:0.6868## F-statistic: 381.1 on 3 and 517 DF,p-value: < 2.2e-16Now the estimates are:CoefficientValueβ0-209.26463β10.22695β230.22199β3-0.01592There are many differences here. The intercept and the Bedrooms coefficient have become larger while the

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture