If the following R data link doesn\'t work, use: hw2_data = read.csv(\"https://r
ID: 3042457 • Letter: I
Question
If the following R data link doesn't work, use:
hw2_data = read.csv("https://raw.githubusercontent.com/gweon/stat420/master/hw2_data.csv")
This is r-studio problem.
2. For question 2, you will use an imported data. Run the following R code (in blue) and use the hw2 data dataset to answer the questions (a)-(d). R code: hw2.data read.csv("https://raw.githubusercontent.com/gweon/stat420/master/hw2.data.csv") The imported dataset contains 25 observations with 2 variables: y (response) and x (predictor). Please include your R codes and outputs for all the following questions. (a) Consider the SLR model Y-Ao +Aztei where i-1, , 25. obtain A, A, and R2. (1 pt) (b) At x=6, construct a 90% prediction interval for a new observation. (1 pt) (c) Is there a significant linear relationship between y and z? Answer the question by testing H0 : 1-0 vs H1 : 10 at = 0.05. (1 pt) (d) Test H0 : A = 10 vs H1: AExplanation / Answer
hw2_data = read.csv("https://raw.githubusercontent.com/gweon/stat420/master/hw2_data.csv")
y <- hw2_data$y
x <- hw2_data$x
> model= lm(y~x)
> summary(model)
Call:
lm(formula = y ~ x)
Residuals:
Min 1Q Median 3Q Max
-17.812 -5.304 2.285 7.133 17.788
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -11.1027 4.6922 -2.366 0.0268 *
x 9.6628 0.7769 12.437 1.08e-11 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 10.22 on 23 degrees of freedom
Multiple R-squared: 0.8706, Adjusted R-squared: 0.8649
F-statistic: 154.7 on 1 and 23 DF, p-value: 1.079e-11
b)
predict (model, data.frame(x = 6), interval = "prediction")
fit lwr upr
1 46.87426 25.29306 68.45545
c)
p-value of b1 is 1.08e-11 < 0.05
hence significant
d)
TS = (9.6628 - 10)/(0.7769)
= -0.43403
pt(-0.43403 , 23 ,lower.tail = TRUE)
[1] 0.3341555
p-value > 0.05
we fail to rejct the null
Please rate