In: Statistics and Probability
Find the equation of the regression line for the given data. Then construct a scatter plot of the data and draw the regression line. (The pair of variables have a significant correlation.) Then use the regression equation to predict the value of y for each of the given x-values, if meaningful. The table below shows the heights (in feet) and the number of stories of six notable buildings in a city.
Height : 772, 628, 518, 508, 496, 483,
y: 51, 48, 44, 42, 37, 35,
(a) x=498 feet (b) x=651 feet Stories,
(c) x=345 feet (d) x=725 feet
Find the regression equation.
^
y=___x+(___)
(Round the slope to three decimal places as needed. Round the y-intercept to two decimal places as needed.)
x <- c(772, 628, 518, 508, 496, 483)
> y <- c( 51, 48, 44, 42, 37, 35)
> model <- lm (y ~ x)
> summary(model)
Call:
lm(formula = y ~ x)
Residuals:
1
2 3
4 5
6
-1.633 2.268 3.539 2.018 -2.407 -3.784
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 15.63989
7.62235 2.052 0.1095
x
0.04792 0.01322
3.626 0.0222 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 3.336 on 4 degrees of freedom
Multiple R-squared: 0.7667, Adjusted R-squared:
0.7084
F-statistic: 13.15 on 1 and 4 DF, p-value: 0.02224
> x_pred <- c(498,651,725)
> predict(model,data.frame(x=x_pred))
1
2 3
39.50304 46.83448 50.38041
y^ = 15.63989 + 0.04792 *x
= 15.64 + 0.048 x
b)
(a) x=498 feet
=39.50304
(b) x=651 feet Stories,
=46.83448
(c) x=345 feet
should predict as 345 is not in sample data
(d) x=725 feet
50.38041