These are items that I thought might be errata for Statistics for the Terrified (5th ed.). I am not sure that they are necessarily incorrect, but they struck me as not being the way I would present them if I were teaching from this book.
scores <- c(4, 3, 10, 3, 3, 2, 9, 3, 8, 3,
2, 3, 1, 5, 4, 0, 1, 4, 0, 3,
2, 4, 3, 1, 4, 2, 8, 2, 1, 2,
1, 5, 2, 9, 3, 6, 4, 4, 3, 2,
1, 4, 1, 3, 3, 2, 2, 2, 8, 3,
9, 4, 9, 3, 3, 10, 1, 3, 5, 3,
2, 2, 4, 3, 3, 6, 6, 4, 1, 2,
6, 2, 3, 7, 4, 4, 4, 4, 2, 4)
table(scores)
## scores
## 0 1 2 3 4 5 6 7 8 9 10
## 2 9 16 20 16 3 4 1 3 4 2
(mas <- c(11, 9, 8, 8, 6))
## [1] 11 9 8 8 6
mas^2
## [1] 121 81 64 64 36
sum(mas^2)
## [1] 366
sum(mas)
## [1] 42
sum(mas)^2
## [1] 1764
length(mas)
## [1] 5
(sd.2 <- (sum(mas^2) - sum(mas)^2/length(mas)) / (length(mas) - 1))
## [1] 3.3
The book gives values of \(\sum X^2 = 351\) when it should be \(\sum X^2 = 366\), \((\sum X)^2 = 1681\) when it should be \((\sum X)^2 = 1764\), and \(SD_x^2 = 3.7\) when it should be \(SD_x^2 = 3.3\).
iq.eq <- data.frame(Student = 1:10,
IQ = c(140, 130, 120, 119, 115, 114, 114, 113, 112, 111),
EQ = c(14, 20, 29, 6, 20, 27, 29, 30, 35, 40),
Exam.Scores = c(42, 44, 35, 30, 23, 27, 25, 20, 16, 12))
iq.eq
## Student IQ EQ Exam.Scores
## 1 1 140 14 42
## 2 2 130 20 44
## 3 3 120 29 35
## 4 4 119 6 30
## 5 5 115 20 23
## 6 6 114 27 27
## 7 7 114 29 25
## 8 8 113 30 20
## 9 9 112 35 16
## 10 10 111 40 12
round(cor(iq.eq[,-1]), 2) # The raw correlations
## IQ EQ Exam.Scores
## IQ 1.00 -0.61 0.88
## EQ -0.61 1.00 -0.66
## Exam.Scores 0.88 -0.66 1.00
round(cor(iq.eq[,-1])^2, 2) # The coefficients of determination
## IQ EQ Exam.Scores
## IQ 1.00 0.37 0.77
## EQ 0.37 1.00 0.44
## Exam.Scores 0.77 0.44 1.00
The correct answer for 1b is 0.88 whereas the book says r_xy = .85. The correct coefficient of determination is 0.77.
g1 <- c(22, 16, 17, 18)
g2 <- c(6, 10, 13, 13, 8, 4)
g3 <- c(8, 6, 4, 5, 2)
A. Compare Groups 2 & 3
(x.bar.A <- mean(g2))
## [1] 9
(x.bar.B <- mean(g3))
## [1] 5
(sd.A <- sd(g2))^2
## [1] 13.6
(sd.B <- sd(g3))^2
## [1] 5
(n.A <- length(g2))
## [1] 6
(n.B <- length(g3))
## [1] 5
x.bar.A - x.bar.B
## [1] 4
(n.A - 1) * sd.A^2
## [1] 68
(n.B - 1) * sd.B^2
## [1] 20
n.A + n.B - 2
## [1] 9
1/n.A
## [1] 0.1667
1/n.B
## [1] 0.2
(t.obt <- (x.bar.A - x.bar.B)/sqrt((((n.A - 1) * sd.A^2 + (n.B - 1) * sd.B^2)/(n.A + n.B - 2)) * (1/n.A + 1/n.B)))
## [1] 2.113
(t.crit <- qt(c(.025, .975), n.A + n.B - 2, lower.tail=TRUE))
## [1] -2.262 2.262
(p.val <- 2 * pt(t.obt, n.A + n.B - 2, lower.tail=FALSE))
## [1] 0.06381
t.test(g2, g3, var.equal=TRUE)
##
## Two Sample t-test
##
## data: g2 and g3
## t = 2.112, df = 9, p-value = 0.06381
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -0.2833 8.2833
## sample estimates:
## mean of x mean of y
## 9 5
B. Compare Groups 1 & 2
(x.bar.A <- mean(g1))
## [1] 18.25
(x.bar.B <- mean(g2))
## [1] 9
(sd.A <- sd(g1))^2
## [1] 6.917
(sd.B <- sd(g2))^2
## [1] 13.6
(n.A <- length(g1))
## [1] 4
(n.B <- length(g2))
## [1] 6
x.bar.A - x.bar.B
## [1] 9.25
(n.A - 1) * sd.A^2
## [1] 20.75
(n.B - 1) * sd.B^2
## [1] 68
n.A + n.B - 2
## [1] 8
1/n.A
## [1] 0.25
1/n.B
## [1] 0.1667
(t.obt <- (x.bar.A - x.bar.B)/sqrt((((n.A - 1) * sd.A^2 + (n.B - 1) * sd.B^2)/(n.A + n.B - 2)) * (1/n.A + 1/n.B)))
## [1] 4.302
(t.crit <- qt(c(.025, .975), n.A + n.B - 2, lower.tail=TRUE))
## [1] -2.306 2.306
(p.val <- 2 * pt(t.obt, n.A + n.B - 2, lower.tail=FALSE))
## [1] 0.002607
t.test(g1, g2, var.equal=TRUE)
##
## Two Sample t-test
##
## data: g1 and g2
## t = 4.302, df = 8, p-value = 0.002607
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## 4.292 14.208
## sample estimates:
## mean of x mean of y
## 18.25 9.00
C. Compare Groups 1 & 3
(x.bar.A <- mean(g1))
## [1] 18.25
(x.bar.B <- mean(g3))
## [1] 5
(sd.A <- sd(g1))^2
## [1] 6.917
(sd.B <- sd(g3))^2
## [1] 5
(n.A <- length(g1))
## [1] 4
(n.B <- length(g3))
## [1] 5
x.bar.A - x.bar.B
## [1] 13.25
(n.A - 1) * sd.A^2
## [1] 20.75
(n.B - 1) * sd.B^2
## [1] 20
n.A + n.B - 2
## [1] 7
1/n.A
## [1] 0.25
1/n.B
## [1] 0.2
(t.obt <- (x.bar.A - x.bar.B)/sqrt((((n.A - 1) * sd.A^2 + (n.B - 1) * sd.B^2)/(n.A + n.B - 2)) * (1/n.A + 1/n.B)))
## [1] 8.186
(t.crit <- qt(c(.975), n.A + n.B - 2, lower.tail=TRUE))
## [1] 2.365
(p.val <- pt(t.obt, n.A + n.B - 2, lower.tail=FALSE))
## [1] 3.933e-05
t.test(g1, g3, var.equal=TRUE, alternative="greater")
##
## Two Sample t-test
##
## data: g1 and g3
## t = 8.186, df = 7, p-value = 3.933e-05
## alternative hypothesis: true difference in means is greater than 0
## 95 percent confidence interval:
## 10.18 Inf
## sample estimates:
## mean of x mean of y
## 18.25 5.00
d.df <- data.frame(pre=c(12, 2, 6, 13, 10, 10, 5, 2, 7, 9, 10, 14),
post=c(18, 3, 5, 10, 15, 15, 6, 9, 7, 9, 11, 13))
describe(d.df)
## vars n mean sd median trimmed mad min max range skew kurtosis
## pre 1 12 8.33 3.98 9.5 8.4 4.45 2 14 12 -0.28 -1.32
## post 2 12 10.08 4.52 9.5 10.0 5.19 3 18 15 0.16 -1.26
## se
## pre 1.15
## post 1.31
So the means are in the correct direction to support the alternative hypothesis, \(\overline{X}_\text{before} < \overline{X}_\text{after}\). That means that if \(|t_\text{obt}| > t_\text{crit}\), then the difference is significant.
t.test(d.df$pre, d.df$post, alternative="less", paired=TRUE)
##
## Paired t-test
##
## data: d.df$pre and d.df$post
## t = -1.898, df = 11, p-value = 0.04214
## alternative hypothesis: true difference in means is less than 0
## 95 percent confidence interval:
## -Inf -0.09391
## sample estimates:
## mean of the differences
## -1.75
qt(.05, nrow(d.df)-1)
## [1] -1.796
It is not clear why the book says do not reject \(\text{H}_0\).
MS.W <- 533.2
x.bar.b <- 12
x.bar.c <- 17
x.bar.p <- 58.3
n.b <- 10
n.c <- 4
n.p <- 4
(C.obt.cb <- (x.bar.c - x.bar.b)/sqrt(MS.W*(1/n.c + 1/n.b)))
## [1] 0.366
(C.obt.pb <- (x.bar.p - x.bar.b)/sqrt(MS.W*(1/n.p + 1/n.b)))
## [1] 3.389
(C.obt.pc <- (x.bar.p - x.bar.c)/sqrt(MS.W*(1/n.p + 1/n.c)))
## [1] 2.529
(F.crit <- qf(.05, 2, 15, lower.tail=FALSE))
## [1] 3.682
(C.crit <- sqrt((3-1) * F.crit))
## [1] 2.714
abs(C.obt.cb) > C.crit
## [1] FALSE
abs(C.obt.pb) > C.crit
## [1] TRUE
abs(C.obt.pc) > C.crit
## [1] FALSE
The only significant post-hoc difference is between bus drivers vs. presidents.