Learn R Programming

MBAnalysis (version 2.1.1)

MBValidation: Cross-Validation for MBPLS or MBWCov

Description

Computes MSEP and corresponding standard error based on Leave One Out (LOO) or Out Of Bag (OOB) Cross-Validation (CV) by number of components of a MBPLS or MBWCov model from MBPLS or MBWCov.

Usage

MBValidation(
  res,
  ncomp.max = min(res$call$ncomp, nrow(res$call$X) - 2, ncol(X)),
  method = "LOO",
  nboot = 1000,
  graph = TRUE,
  size.graph = 2.25
)

Value

A matrix with two rows (MSEP and std.error) and ncomp.max+1 columns. The +1 column corresponds to the null model (Dim.0) where Y is predicted by its empirical average on the training sample.

Arguments

res

An object resulting from MBPLS or MBWCov.

ncomp.max

The maximum number of components to be investigated in the CV procedure.

method

Either "LOO" or "OOB". Default is LOO.

nboot

Number of bootstrap samples to be generated in case of OOB CV.

graph

Logical. Should the results be plotted? Default is TRUE.

size.graph

If graph=TRUE, the overall size of labels, points, etc.

See Also

predict.MBPLS predict.MBWCov

Examples

Run this code
# With MBPLS

data(ham)
X=ham$X
block=ham$block
Y=ham$Y
res.mbpls <- MBPLS(X, Y, block, name.block = names(block))
MBValidation(res.mbpls)

# With MBWCov

data(ham)
X=ham$X
block=ham$block
Y=ham$Y
res.mbwcov <- MBWCov(X, Y, block, name.block = names(block))
MBValidation(res.mbwcov)

Run the code above in your browser using DataLab