# Errata for Linear Models in R

## First Printing

• p12. Displayed Equation 2 should read xi1, xi2 and xi3 in lieu of x1i, x2iand x3i.
• p23, Question 4, variable is lpbh lbph not lpph
• p35, line 3 - should be betaddpi.
• p35, line 6 - zero is not in the interval.
• p45, line 2 - should read
```F-statistic: 5.76 on 4 and 45 DF,  p-value: 0.00079
```
• p59, long-tailed is leptokurtic, short-tailed is platykurtic.
• p87, Q3 dataset is divusa not divorce
• p90, last displayed equation, printing error overplots rho and epsilon.
• p101, library(lqs) is now included in MASS(R Version 2.0.0+)
• p107, Q2 dataset is divusa not divorce
• p113, Fig 7.3 is missing the broken stick fitted lines - it should appear as

• p136, library(mva) is unnecessary since functions in this package are now loaded by default. (R Version 2.0.0)
• p184 - (2nd para from the bottom) Should read "means for B and C are 66 and 68"
• p189-193, over printing errors - overplots of alpha and beta.

## Second Printing

• Preface, x, I have moved - the new book web site is at http://www.maths.bath.ac.uk/~jjf23/LMR
• p12 and elsewhere, "fi" has been printed as £ i.e de£nition should read as definition.
• p16 2/3 way down: "..errors are uncorrelated and have equal variance"
• p32, replace 30! with n!
• p51, question 4(b), test the hypothesis that beta_takers=0
• p78, Figure 5.1, line should be labeled as y=beta_0+beta_1x
• p136, midpage, should read "The eigenvectors can be found in the object..."
• p136, second para from bottom, is better worded as "These vectors are used for the linear combinations..."
• p137, just before second R command: "..plot it in the right of Figure 9.3"
• p139, package pls.pcr has been replaced with package pls in more recent versions of R. Last paragraph is now: The pls package can compute this CV. By default, the data is divided into ten parts for the CV:
```> pcrmod <- pcr(fat ~ ., data=meatspec[1:172,], validation="CV",ncomp=50)
> validationplot(pcrmod)
```
• p140, validationplot() above produces a slightly different plot for the right panel of Figure 9.5.
• p141, The plsr() function now centers the predictors internally. So first sentence can now read "We now compute the PLS on all models up to size 50". The next chunk of R code becomes:
```> plsg <- plsr(fat ~ ., data=meatspec[1:172,], ncomp=50, validation="CV")
> coefplot(plsg,ncomp=4,xlab="Frequency")
> validationplot(plsg)
```
The centering described in the last two sentences of p141 is now redundant. Last chunk of R code becomes:
```> ypred <- predict(plsg,ncomp=14)
> rmse(ypred,meatspec\$fat[1:172])
```
• p142, chunk of R code becomes:
```> ytpred <- predict(plsg,meatspec[173:215,],ncomp=14)
> rmse(ytpred,meatspec\$fat[173:215])
```
Note also that Figure 9.7 is somewhat changed by using the plotting functions from the pls package.
• p146, question 4. Data is fat not bodyfat
• p174, The groups in the fruitfly data are wrongly attributed - replace the offending sentence with "The five groups are labeled isolated, low, high, one and many respectively". Furthermore, the levels of activity have also been incorrectly labeled in the data. The following transpositions should be made: low<->many, many<->isolated, isolated<->one and one<->low. Fortunately, high activity is correct and this is the only level that differs much from the rest. Also, the dataset as presented here is missing one observation from that presented in the original article.
• p189-193, over printing errors - overplots of phi, alpha and beta.
• p193, the numbers for Ntape and Nlaser are explained on the help page for composite
• p217, package pls.pcr has been replaced by pls. Also, I have moved - the new book web site is at http://www.maths.bath.ac.uk/~jjf23/LMR

## Third Printing

• p23, Question 4, variable is lbph not lpbh
• p66, Last two equations have a double closing parenthesis where they should be only one.
• p136, Should read "We can examine the square roots of the eigenvalues of cov(X)". cov(X) = XTX/(n-1) where the columns of X have been mean-centered.
• p141 The centering described in the last two sentences is not relevant. (It refers to an earlier version of the software).
• p144, changes to the earlier printing removed the definitions of the centered training and test sets. These now need to be computed here before fitting the ridge regression model as
```> trainx <- as.matrix(sweep(meatspec[1:172,-101],2,mm))
> testx <-  as.matrix(sweep(meatspec[173:215,-101],2,mm))
```
• p146, Question 4. To be more explicit, use siri as the measure of body fat. Do not use brozek or density as predictors.
• p208, there is an error in the computation of the relative efficiency which should read:
```> summary(g)\$sig
[1] 36.564
> (47.047/36.564)^2
[1] 1.6556
```
Thus the CRD would require only 66% more observations not 93%.