In: Math
A statistical program is recommended.
Consider the following data for two variables, x and y.
x | 22 | 24 | 26 | 30 | 35 | 40 |
---|---|---|---|---|---|---|
y | 12 | 20 | 32 | 36 | 39 | 36 |
(a). Develop an estimated regression equation for the data of the form
ŷ = b0 + b1x.
(b). Use the results from part (a) to test for a significant relationship between x and y. Use α = 0.05.
Find the value of the test statistic.
Find the p-value.
Is the relationship between x and y significant?
(c) Develop a scatter diagram for the data.
Does the scatter diagram suggest an estimated regression equation of the form ŷ = b0 + b1x + b2x2? Explain.
(d). Develop an estimated regression equation for the data of the form ŷ = b0 + b1x + b2x2.
(e) Use the results from part (d) to test for a significant relationship between x, x2, and y. Use α = 0.05. Is the relationship between x, x2, and y significant?
Find the value of the test statistic.
Find the p-value.
(f). Use the model from part (d) to predict the value of y when x = 25.
Perform linear regression n R
Rcode is
x <- c(22, 24,
26, 30, 35, 40)
y <- c(12, 20, 32,
36, 39, 36)
reg<-lm(y ~ x)
coeff=coefficients(reg)
coeff
# equation of the line :
eq = paste0("y = ", round(coeff[2],4), "*x ",
round(coeff[1],4))
eq
attach(TrackRecords)
# plot
plot( x,y, main=eq)
abline(reg, col="blue")
(a). Develop an estimated regression equation for the data of the form
ŷ = b0 + b1x.
y=-7.6006+1.2463*x
(b). Use the results from part (a) to test for a significant relationship between x and y. Use α = 0.05.
using Rcode:
summary(reg)
Ouptut:
Call:
lm(formula = y ~ x)
Residuals:
1 2 3 4 5 6
-7.819 -2.312 7.196 6.210 2.978 -6.253
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -7.6006 13.9489 -0.545 0.6148
x 1.2463 0.4624 2.696 0.0543 .
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 7.155 on 4 degrees of freedom
Multiple R-squared: 0.645, Adjusted R-squared:
0.5562
F-statistic: 7.266 on 1 and 4 DF, p-value: 0.05434
the value of the test statistic.
t=2.696
the p-value=0.0543
Ho:slope=0
Ha:slope not =0
t=2.696
the p-value=0.0543
p>0.05
Fail to Reject Ho:
Accept Ho.
relationship between x and y significant is not significant
(c) Develop a scatter diagram for the data.
Rcode:
plot( x,y, main="Scatterplot")
Output:
From scatterplot we observe:
Form:linear
Direction:positive
strength:strong
Yes
The scatter diagram suggest an estimated regression equation of the form ŷ = b0 + b1 x