woldcv | R Documentation |
Performs a cross-validation procedure for EOF/PCA according to an interpolation routine for substituted missing values
woldcv( dat, fracValid = 0.2, centered = TRUE, scaled = FALSE, uncenter.recon = TRUE, unscale.recon = TRUE, ... )
dat |
Dataset (matrix) |
fracValid |
Fraction of data to use for each validation. Will determine the number of cross-validation groups (Default=0.2) |
centered |
Center data (logical). Passed to eof. Default = TRUE. |
scaled |
Scale data (logical). Passed to eof Default = FALSE. |
uncenter.recon |
Logical. Compare eof reconstruction to uncentered dat. If centered = FALSE, then this has no effect. Default = TRUE. |
unscale.recon |
Logical. Compare eof reconstruction to unscaleded dat. If scaled = FALSE, then this has no effect. Default = TRUE. |
... |
Additional parameters to pass to eof |
List of sum of square error (SS), root mean square error (RMSECV) of cross-validation, number of values used in validation (npred), number of groups used in cross-validation (ngroups)
Wold S (1978) Technometrics 20:397-405
### wine dataset example data(wine) dat <- as.matrix(wine[,-1]) # uncenter and unscale reconstruction res <- woldcv(dat, fracValid=0.1, centered=TRUE, scaled=TRUE, uncenter.recon = TRUE, unscale.recon = TRUE) op <- par(mfrow=c(1,2)) plot(res$SS, t="b"); which.min(res$SS) plot(res$RMSECV, t="b"); which.min(res$RMSECV) par(op) res$ngroups res$npred # Comparison to centered and scaled data res <- woldcv(dat, fracValid=0.1, centered=TRUE, scaled=TRUE, uncenter.recon = FALSE, unscale.recon = FALSE) op <- par(mfrow=c(1,2)) plot(res$SS, t="b"); which.min(res$SS) plot(res$RMSECV, t="b"); which.min(res$RMSECV) par(op) res$ngroups res$npred ### iris dataset example data(iris) dat <- as.matrix(iris[,-5]) # uncenter and unscale reconstruction res <- woldcv(dat, fracValid=0.1, centered=TRUE, scaled=TRUE, uncenter.recon = TRUE, unscale.recon = TRUE) op <- par(mfrow=c(1,2)) plot(res$SS, t="b"); which.min(res$SS) plot(res$RMSECV, t="b"); which.min(res$RMSECV) par(op) res$ngroups res$npred # comparison to centered and scaled data res <- woldcv(dat, fracValid=0.2, centered=TRUE, scaled=TRUE, uncenter.recon = FALSE, unscale.recon = FALSE) op <- par(mfrow=c(1,2)) plot(res$SS, t="b"); which.min(res$SS) plot(res$RMSECV, t="b"); which.min(res$RMSECV) par(op) res$ngroups res$npred
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.