In: Statistics and Probability
COMPUTER CALCULATIONS:
I need to know how to code in R for the solutions, not by hand.
2. Look at the data in Table 7.18 on page 368 of the textbook. These data are also
given in the SAS code labeled “SAS_basketball_goal_data” and R code labeled basketball goal data .
The dependent variable is goals and the independent variable is height of basketball players.
Complete a SAS /R program and answer the following questions about the data set:
(a) Does a scatter plot indicate a linear relationship between the two variables?
Is there anything disconcerting about the scatter plot? Explain.
(b) Fit the least-squares regression line (using SAS / R) and interpret the estimated slope
in the context of this data set. Does it make sense to interpret the estimated intercept? Explain.
(c) For these data, what is the unbiased estimate of the error variance? (Give a number.)
(d) Using the SAS / R output, test the hypothesis that the true slope of the regression line
is zero (as opposed to nonzero). State the appropriate null and alternative hypotheses,
give the value of the test statistic and give the appropriate P-value. (Use significance
level of 0.05.) Explain what this means in terms of the relationship between the two
variables.
(e) Using SAS / R, find a 95% confidence interval for the mean basketball goal for
a player with a height of 77 inches. In addition find a 95% prediction interval for
basketball goal for a player with a height of 77 inches.
Data:
Height | Goals |
71 | 15 |
74 | 19 |
70 | 11 |
71 | 15 |
69 | 12 |
73 | 17 |
72 | 15 |
75 | 19 |
72 | 16 |
74 | 18 |
71 | 13 |
72 | 15 |
73 | 17 |
72 | 16 |
71 | 15 |
75 | 20 |
71 | 15 |
75 | 19 |
78 | 22 |
79 | 23 |
72 | 16 |
75 | 20 |
76 | 21 |
74 | 19 |
70 | 13 |
(a) Does a scatter plot indicate a linear relationship between the two variables?
Is there anything disconcerting about the scatter plot? Explain.
there is existence of linear relationship.
(b) Fit the least-squares regression line (using SAS / R) and interpret the estimated slope
in the context of this data set. Does it make sense to interpret the estimated intercept? Explain.
(Intercept) x
-71.451 1.209
there is 1.209 times effect on y in terms of x.
(c) For these data, what is the unbiased estimate of the error variance? (Give a number.)
MSE=0.6463807
(d) Using the SAS / R output, test the hypothesis that the true slope of the regression line
is zero (as opposed to nonzero). State the appropriate null and alternative hypotheses,
give the value of the test statistic and give the appropriate P-value. (Use significance
level of 0.05.) Explain what this means in terms of the relationship between the two
variables.
Estimate Std. Error t value Pr(>|t|)
(Intercept) -71.45054 4.82700 -14.8 3.02e-13 ***
x 1.20946 0.06609 18.3 3.32e-15 ***
# R code for this problem is
data=read.csv("Book1.csv")
y=data$Goals
x=data$Height
plot(x,y,main = "plot of basketball goal data ")
fit=lm(y~x)
fit
# MSE
deviance(fit)/df.residual(fit)
#summary of fit
summary(fit)