a) p-value= 0.08520488
b) p-value= 0.003293571
Exercises for Exam 2
a) p-value= 0.08520488
b) p-value= 0.003293571
## a) One sample t test with alpha 0.05
## H0: mu >= 5; H1: mu < 5
(t_test <- (4.6 - 5) / (2.2/sqrt(20)))[1] -0.8131156
(t_cri <- qt(p = 0.05, df = 20 - 1)) ## Do not reject H0[1] -1.729133
[1] 3.570368 5.629632
## c)
# Not agree. The test is one-sided, but the CI is two-sided.a) paired.
b) independent.
c) paired.
d) paired.
| Version | \(n\) | \(\bar{x}\) | \(s\) | min | max |
|---|---|---|---|---|---|
| A | 30 | 79.4 | 14 | 45 | 100 |
| B | 27 | 74.1 | 20 | 32 | 100 |
n1 = 30; x1_bar = 79.4; s1 = 14
n2 = 27; x2_bar = 74.1; s2 = 20
A <- s1^2 / n1; B <- s2^2 / n2
df <- (A + B)^2 / (A^2/(n1-1) + B^2/(n2-1))
(df <- floor(df))[1] 45
## t_test
(t_test <- (x1_bar - x2_bar) / sqrt(s1^2/n1 + s2^2/n2))[1] 1.147085
## t_cv
qt(p = 0.01, df = df, lower.tail = FALSE)[1] 2.412116
## p_value
pt(q = t_test, df = df, lower.tail = FALSE)[1] 0.1287044
# the data do not convincingly show that one exam
# version is more difficult than the other| Source | Df | Sum Sq | Mean Sq | F value | Pr(>F) |
|---|---|---|---|---|---|
| major | 2 | 0.03 | 0.015 | 0.185 | 0.8313 |
| Residuals | 195 | 15.77 | 0.081 |
## (a)
# H0: mu1 = mu2 = mu3; H1: not all mus are equal
## (b)
# p-value > 0.05. The data do not provide convincing evidence of a
# difference between the average GPAs across three groups of majors.
## (c)
# The total degrees of freedom is 195 + 2 = 197, so the sample size is 197 + 1 = 198.## (a)
## test statistic
(20 - 1)*10^2/(15^2)[1] 8.444444
## critical values
qchisq(p = 0.05/2, df = 19, lower.tail = TRUE)[1] 8.906516
qchisq(p = 0.05/2, df = 19, lower.tail = FALSE)[1] 32.85233
## p-value
2*pchisq((20 - 1)*10^2/(15^2), df = 19)[1] 0.03677387
## (b)
## test statistic
(5 - 1)*18^2/(12^2)[1] 9
## critical value
qchisq(p = 0.01, df = 4, lower.tail = FALSE)[1] 13.2767
## p-value
pchisq((5 - 1)*18^2/(12^2), df = 4, lower.tail = FALSE)[1] 0.06109948