I find some packages to plot PCA graphics.But I find some packages can calculate Q2 and R2X.I don't know what they are meanings.for example prcomp only provides variable,ropls can provides R2X.
This is my R codes
Thanks your reply.
I use the same data with SIMICA to plot PCA.R2X is PC,R2X(cum) is sum(PC).But Q2 I don't know how it works.There is not Q2 value with ropls package.
The ropls R package implements the PCA, PLS(-DA) and OPLS(-DA) approaches with the original, NIPALS-based, versions of the algorithms (Wold, Sjostrom, and Eriksson 2001; Trygg and Wold 2002). It includes the R2 and Q2 quality metrics (Eriksson et al. 2001; Tenenhaus 1998), the permutation diagnostics (Szymanska et al. 2012), the computation of the VIP values (Wold, Sjostrom, and Eriksson 2001), the score and orthogonal distances to detect outliers (Hubert, Rousseeuw, and Vanden Branden 2005), as well as many graphics (scores, loadings, predictions, diagnostics, outliers, etc).
the Q2 metric is one of the metrics provided by the ropls package. However, to understand how Q2 is calculated and used, it's probably better to ask on Cross Validated, the Stack Exchange site about statistics. Here's a related post from there: What is the Q² value for each component of a PCA