Errata are corrected as found and incorporated into newly printed copies of the book. This means that not all the errata listed below exist in your copy of the book. If you see any errors not listed below, please let me know.

gdf <- group_by(wcgs, cut(linpred, breaks=unique(quantile(linpred, (1:100)/100))))


gdf <- group_by(wcgs, ntile(linpred,100))

The original fails because the largest and smallest values get sorted into an NA category. The ntile function chooses the breakpoints so that there are a roughly equal number of observations per bin. We choose 100 bins. This should be varied according to the size of the dataset.

gdf <- group_by(wcgsm, cut(linpred, breaks=unique(quantile(linpred, (1:100)/101))))


gdf <- group_by(wcgsm, ntile(linpred,100))
> c(hlstat, nrow(hldf))
[1] 127.99 100.00
> 1-pchisq(127.99, 100-2)
[1] 0.02262
rmodr <- refit(rmod, ryield)


rmodr <- lmer(ryield ~ treat + (1|blend), penicillin)

The replacement achieves the same intended purpose but is slightly less efficient than the original. - p378 LHS of formula for the likelihood ratio test statistic is missing a minus