In: Statistics and Probability
Can someone provide guidance for g-i for the following question? Someone already responded to a-f. Age (years) Amount of Activity (hours) 7 4.3 9 3.2 10 1.0 13 1.5 12 1.2 15 0.8 9 3.0 12 4.0 15 1.5 14 1.9
A psychologist believed that as children get older, they engage in more “inactive activities” such as playing computer games, watching TV and surfing the internet. She collected data from 10 children. She recorded the age of each child and the amount of activity (in hours) the child engaged in per week. The table below gives the data for this hypothetical study (it is also available in activity.txt).
a. Using R, obtain a scatterplot of the data. Discuss the relationship between age and activity based on the scatterplot.
b. Using R, obtain the simple linear regression linear regression line predicting activity from age.
c. Interpret the intercept and slope of the regression line
d. By hand, predict the amount of activity for age = 14
e. By hand, calculate the residual for age = 14
f. Using R output, test the null hypothesis that the slope coefficient is zero using the p-value approach. Write one sentence interpreting the meaning of this result. Make sure to report the test statistic and p-value.
g. Using R, obtain and report the 95% CI for the slope coefficient. Explain how we can use it to make a decision about the null hypothesis from part (f).
h. Using R output, test the null hypothesis that the population coefficient of determination is zero using the p-value approach, and write one sentence interpreting your result. Make sure to report the test statistic and p-value.
i. How do the test statistics in (f) and (h) mathematically relate to each other?
> age=c(7,9,10,13,12,15,9,12,15,14)
> act=c(4.3,3.2,1,1.5,1.2,0.8,3,4,1.5,1.9)
> fit=lm(act~age)
g)
> confint(fit,'age',0.95)
2.5 % 97.5 %
age -0.5907166 -0.02156407
Confidence interval does not contain 0 , it means that slope coefficient does not equal to zero.
h)
> summary(fit)
Call:
lm(formula = act ~ age)
Residuals:
Min 1Q Median 3Q Max
-1.72982 -0.37719 0.06404 0.37127 1.88246
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 5.7912 1.4675 3.946 0.00426 **
age -0.3061 0.1234 -2.481 0.03807 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 1.021 on 8 degrees of freedom
Multiple R-squared: 0.4348, Adjusted R-squared: 0.3641
F-statistic: 6.154 on 1 and 8 DF, p-value:
0.03807
R2 is nothing but the square of correlation coefficient. This can be tested by using t test as follows.
> cor.test(age,act)
Pearson's product-moment correlation
data: age and act
t = -2.4807, df = 8, p-value = 0.03807
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
-0.91085597 -0.05088912
sample estimates:
cor
-0.6593879
since p value is less than 0.05 we say that correlation is not equal to zero and ultimately coefficient of determination also not equal to zero