valid(X, Y, ncomp = min(6, ncol(X)),
mode = c("regression", "invariant", "classic"),
method = c("pls", "spls"),
keepX = if(method == "pls") NULL else c(rep(ncol(X), ncomp)),
keepY = if(method == "pls") NULL else c(rep(ncol(Y), ncomp)),
validation = c("loo", "Mfold"),
M = if(validation == "Mfold") 10 else nrow(X),
max.iter = 500,
tol = 1e-06,
na.action = c("omit", "predict"),
predict.par = NULL)
NA
s are allowed.NA
s are allowed.min(6, ncol(X)
."classic"
, "invariant"
or "regression"
.pls
or spls
.method="spls"
numeric vector of length ncomp
, the number of variables
weights to keep in $X$-loadings. By default all variables are kept in the model.method="spls"
numeric vector of length ncomp
, the number of variables
weights to keep in $Y$-loadings. By default all variables are kept in the model.X
.
One of "predict"
or "omit"
(see Details).nipals
function.valid
produces a list with the following components:na.action = "predict"
the estimation of the missing values is performed
by the reconstitution of the data matrix using the nipals
function. Otherwise, missing
values are handled by deletion of incomplete cases.
The validation criterion "MSEP"
, "RMSEP"
or "R2"
allows one to assess the
predictive validity of the model using M-fold or leave-one-out cross-validation.
Note that only the classic
, regression
and invariant
modes can be applied.
If validation = "Mfold"
, M-fold cross-validation is performed.
How many folds to generate is selected by specifying the number of folds in M
.
If validation = "loo"
, leave-one-out cross-validation is performed.predict
, nipals
, code{plot.valid}.data(liver.toxicity)
X <- liver.toxicity$gene
Y <- liver.toxicity$clinic
liver.val <- valid(X, Y, ncomp = 5, mode = "regression",
method = "pls", validation = "loo")
Run the code above in your browser using DataLab