In: Statistics and Probability
3. 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). 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. 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?
a)
b)
y^ = 5.7912 - 0.3061 x
c)
slope as age increase by 1 year, amount of activity decreases by 0.3061 hours
intercept is not meaningful here
d)
y^ = 5.7912 - 0.3061 *14 = 1.5058
e)
residual = actual-predicted = 1.9 - 1.5058 = 0.3942
code
x <- c(7,9,10,13,12,15,9,12,15,14)
> y <- c(4.3,3.2,1,1.5,1.2,.8,3,4,1.5,1.9)
> model <- lm(y ~x)
> summary(model)
Call:
lm(formula = y ~ x)
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 **
x
-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
> plot(x,y)