R/pcr.cv.R
pcr.cv.Rd
This function computes the optimal model parameter using cross-validation. Mdel selection is based on mean squared error and correlation to the response, respectively.
pcr.cv( X, y, k = 10, m = min(ncol(X), nrow(X) - 1), groups = NULL, scale = TRUE, eps = 1e-06, plot.it = FALSE, compute.jackknife = TRUE, method.cor = "pearson", supervised = FALSE )
X | matrix of predictor observations. |
---|---|
y | vector of response observations. The length of |
k | number of cross-validation splits. Default is 10. |
m | maximal number of principal components. Default is
|
groups | an optional vector with the same length as |
scale | Should the predictor variables be scaled to unit variance?
Default is |
eps | precision. Eigenvalues of the correlation matrix of |
plot.it | Logical. If |
compute.jackknife | Logical. If |
method.cor | How should the correlation to the response be computed? Default is ''pearson''. |
supervised | Should the principal components be sorted by decreasing squared correlation to the response? Default is FALSE. |
matrix of cross-validated errors based on mean squared error. A row corresponds to one cross-validation split.
vector of cross-validated errors based on mean squared error
optimal number of components based on mean squared error
intercept of the optimal model, based on mean squared error
vector of regression coefficients of the optimal model, based on mean squared error
matrix of cross-validated errors based on correlation. A row corresponds to one cross-validation split.
vector of cross-validated errors based on correlation
optimal number of components based on correlation
intercept of the optimal model, based on correlation
vector of regression coefficients of the optimal model, based on correlation
Array of the regression coefficients on each
of the cross-validation splits, if compute.jackknife=TRUE
. In this
case, the dimension is ncol(X) x (m+1) x k
.
The function computes the principal components on the scaled predictors.
Based on the regression coefficients coefficients.jackknife
computed
on the cross-validation splits, we can estimate their mean and their
variance using the jackknife. We remark that under a fixed design and the
assumption of normally distributed y
-values, we can also derive the
true distribution of the regression coefficients.
Nicole Kraemer, Mikio L. Braun