Attribute the two PCA cross-validation schemes correctly - #289
Merged
Conversation
Two claims in this section were wrong, and both are live on the site. The row-projection procedure is credited to Wold. Wold's 1978 paper, which introduced cross-validation for component models, held out a scattered pattern of individual elements and estimated them as missing values; it did not hold out rows. The section then had Bro and co-authors recommending element deletion "instead", which stages a correction of Wold that never happened, since Wold was already deleting elements. The procedure is now named for what it is, the review's point is stated as the independence requirement it is, and the element-wise remedy is credited to Wold, with Eastment and Krzanowski (1982) named for the two-model route to the same property. The bar plot is labelled Simca-P's output "from the row-wise scheme". Simca-P cross-validates a PCA element-wise, by the Eastment and Krzanowski route; its row-wise scheme is for PLS. The recorded curve agrees: it falls at four component counts, which the row-projection scheme cannot do, because nested loadings make its reconstruction error monotone. So the comparison that followed was element-wise against element-wise, not the contrast it claimed. It now says so, and its closing sentence draws the conclusion that actually follows: two schemes forming their predictions differently read these data the same way. No number moved. The four code blocks of the chapter pass, and the element-wise curve is unchanged. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LXthGpHLQFfGubBiKFtGAE
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two claims in
latent-variable-modelling/principal-component-analysis/determining-the-number-of-components-to-use-in-the-model-with-cross-validation.rstare wrong. Both are live on the site at<https://learnche.org/pid/latent-variable-modelling/principal-component-analysis/determining-the-number-of-components-to-use-in-the-model-with-cross-validation>.They surfaced while researching a question about why a PCA is cross-validated cell by cell rather than row by row, and they are unrelated to the batch case studies in #273, which is why this is a separate pull request.The Wold attribution
The section describes building the model on the retained rows, projecting the held-out rows onto the loadings to get their scores, reconstructing and taking residuals, and calls it "Wold's cross-validation procedure". Wold's 1978 paper, the one that introduced cross-validation for component models, did not hold out rows. It held out a scattered pattern of individual elements along pseudo-diagonals and estimated them as missing values with NIPALS.
The consequence sat further down, where the text had Bro and co-authors recommending element deletion "instead". That stages a correction of Wold that never happened, because Wold was already deleting elements thirty years earlier.
Changed:
I could not read Wold (1978) directly, since it is paywalled with no open copy. Four mutually independent secondary sources agree on what it did: Owen and Perry in the Annals of Applied Statistics, Perry's Stanford thesis, Camacho and Ferrer, and the Bioconductor pcaMethods documentation.
The Simca-P label
The section says the bar plot is "Simca-P's output, from the row-wise scheme", and builds a "same data, both schemes" comparison on that. Simca-P cross-validates a PCA element-wise, by the Eastment and Krzanowski route: rows are held out to estimate the loadings, columns to estimate the scores. Its row-wise cross-validation is reserved for PLS and OPLS, which is the likely source of the mix-up. The Simca 15 User Guide states this in section 16.8.1.
The recorded curve agrees. In
figures/pca/barplot-for-R2-and-Q2.Rthe Simca-P series falls at components 3, 4, 6 and 7. The row-projection scheme cannot produce that: its loadings are nested, so the reconstruction error can only shrink as components are added, and a Q² of one minus PRESS over the total sum of squares cannot dip. The ProSensus series recorded beside it never falls and tracks R² to within a few points, which is what the row-projection scheme does produce.Changed:
Verification
make check-code-fileon this file, which runs the chapter in order against the released library: 4 blocks, all passed. The element-wise curve is unchanged at 0.292, 0.404, 0.374, 0.343, 0.341, 0.240, 0.100, 0.193, 0.696, 0.850, 0.807.make text: zero warnings.CITATION.cff: version2026.09.10, date-released2026-09-10.Paired change
The same mislabel is in the figure's legend. kgdunn/figures#96 corrects it and regenerates
pca/q2-across-packages.png. That one should merge first, since the PDF build resolves figures from the figures repository's default branch.🤖 Generated with Claude Code
https://claude.ai/code/session_01LXthGpHLQFfGubBiKFtGAE
Generated by Claude Code