In: Statistics and Probability
Given below are seven observations collected in a regression
study on two variables, x (independent variable) and y (dependent
variable)
|
|||||||||||||||||
a. develop the least squares estimated regression equation
b. At 95% confidence, perform a t test and determine whether or not the slope is significantly different from 0
c.Compute the coefficient of determination
d. Develop the 95% confidence interval for the mean value of y* and 95% prediction interval for individual value of y* when x*=5
To get the regression eq use lm function in R
and to get the predcition and confdience intervals use predict fucntion
Solution-A:
Rcode:
df=data.frame(X=c(2,3,6,7,8,7,9), Y=c(12,9,8,7,6,5,2))
regeq <- lm(Y~X,data=df)
summary(regeq)
Output:
we get
the least squares estimated regression equation from output
Y= 13.750 -1.125 *X
b. At 95% confidence, perform a t test and determine whether or not the slope is significantly different from 0
Ho:slope=0
Ha=slope not = 0
alpha=0,05
t statistic=coefficient of slope/std error
= -1.1250/0.2165
= -5.196
p=0.003478
p<0.05
Reject Ho
Accept Ha
Conclusion:
There is sufficient statistical evidence at 5% level of significance to conclude that the slope is significantly different from 0
c.Compute the coefficient of determination
From output:
Rsq=0.8438
=84.38% variation in Y is explained by X
Solution-d:
From output
95% confidence interval for x=5 is
6.682878 and 9.567122
Solution-d:
95% prediction interval for x=5 is
4.321119 and 11.92888