In: Statistics and Probability
a. Using the following R codes to fit the linear regression model for VitC on HeadWt, and obtain its summary. Paste the R output in your homework. cabbages_data <- read.csv("http://users.stat.umn.edu/~wuxxx725/data/cabbages_data.csv") cabbages_reg <- lm(VitC ~ HeadWt, data = cabbages_data) summary(cabbages_reg)
b. State and interpret the value of r 2 from the model summary output in part a).
c. Calculate the correlation r between HeadWt and VitC, and state the strength and the direction of the correlation.
d. State the estimated regression equation in the form VitC ˆ = a + b(HeadWt).
e. Interpret the slope b in the estimated regression equation in part d).
f. Cabbage head #20 had a weight of 2.0 kg. Predict its vitamin C content using the estimated regression equation in part d)
g. The actual vitamin C content for cabbage head #20 was 60 mg/100 g. Find its residual based on your answer in parts f).
h. How would the correlation r between HeadWt and VitC change, if HeadWt were measured in pounds instead of kilograms? Please explain. (1 kg = 2.205 lbs)
i. Check the linearity, normal error, and constant variance assumptions using the following plots.
j. Conduct a five-step hypothesis test on whether the true slope β is different from 0 at the significance level 0.05.
a)
> cabbages_data <-
read.csv("http://users.stat.umn.edu/~wuxxx725/data/cabbages_data.csv")
> cabbages_reg <- lm(VitC ~ HeadWt, data =
cabbages_data)
> summary(cabbages_reg)
Call:
lm(formula = VitC ~ HeadWt, data = cabbages_data)
Residuals:
Min 1Q Median 3Q Max
-8.9317 -4.5844 -0.6325 4.3333 13.0863
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 79.554 3.353 23.723 < 2e-16 ***
HeadWt -6.647 1.380 -4.817 4.57e-05 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’
1
Residual standard error: 6.363 on 28 degrees of
freedom
Multiple R-squared: 0.4532, Adjusted R-squared:
0.4337
F-statistic: 23.21 on 1 and 28 DF, p-value: 4.57e-05
b)
Multiple R-squared: 0.4532
there is 45.32% variation in the VitC which is explaiend by headWt.
c)
> cor.test( ~VitC+HeadWt, data=cabbages_data)
Pearson's product-moment correlation
data: VitC and HeadWt
t = -4.8173, df = 28, p-value = 4.57e-05
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
-0.8317424 -0.4131245
sample estimates:
cor
-0.6731977
there is a strong negative linear relationship between VitC and HeadWt
d)
VitC ˆ = 79.554 + -6.647 (HeadWt)