F-statistic: 5.76 on 4 and 45 DF, p-value: 0.00079
> pcrmod <- pcr(fat ~ ., data=meatspec[1:172,], validation="CV",ncomp=50) > validationplot(pcrmod)
> 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])
> 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.
> trainx <- as.matrix(sweep(meatspec[1:172,-101],2,mm)) > testx <- as.matrix(sweep(meatspec[173:215,-101],2,mm))
> summary(g)$sig [1] 36.564 > (47.047/36.564)^2 [1] 1.6556Thus the CRD would require only 66% more observations not 93%.