Exercise 7: linear regression (Pg. 295)
Set up an Excel worksheet to apply formulas (8.5) and (8.6) to compute the values of b0 and b1 for the data in the Excel file Home Market Value and verify that you obtain the same values as in Examples 8.4 and 8.5.
data <- read.csv("./data/home_market_value.csv")
data
lm1 <- lm(data$Market.Value ~ data$Square.Feet - data$House.Age)
summary(lm1)
##
## Call:
## lm(formula = data$Market.Value ~ data$Square.Feet - data$House.Age)
##
## Residuals:
## Min 1Q Median 3Q Max
## -8067 -4327 -1923 3097 32634
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 32673.220 8831.951 3.699 0.00065 ***
## data$Square.Feet 35.036 5.167 6.780 3.8e-08 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 7288 on 40 degrees of freedom
## Multiple R-squared: 0.5347, Adjusted R-squared: 0.5231
## F-statistic: 45.97 on 1 and 40 DF, p-value: 3.798e-08
b0 = 32673.220, b1 = 35.036, which are the same results as example.