tune.rcc: Estimate the parameters of regularization for Regularized CCA

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/tune.rcc.R

Description

Computes leave-one-out or M-fold cross-validation scores on a two-dimensional grid to determine optimal values for the parameters of regularization in rcc.

Usage

1
2
3
4
tune.rcc(X, Y, grid1 = seq(0.001, 1, length = 5), 
            grid2 = seq(0.001, 1, length = 5), 
            validation = c("loo", "Mfold"),
            folds = 10, plot = TRUE)

Arguments

X

numeric matrix or data frame (n \times p), the observations on the X variables. NAs are allowed.

Y

numeric matrix or data frame (n \times q), the observations on the Y variables. NAs are allowed.

grid1, grid2

vector numeric defining the values of lambda1 and lambda2 at which cross-validation score should be computed. Defaults to grid1=grid2=seq(0.001, 1, length=5).

validation

character string. What kind of (internal) cross-validation method to use, (partially) matching one of "loo" (leave-one-out) or "Mfolds" (M-folds). See Details.

folds

positive integer. Number of folds to use if validation="Mfold". Defaults to folds=10.

plot

logical argument indicating whether a image map should be plotted by calling the imgCV function.

Details

If validation="Mfolds", M-fold cross-validation is performed by calling Mfold. When folds is given, the elements of folds should be integer vectors specifying the indices of the validation sample and the argument M is ignored. Otherwise, the folds are generated. The number of cross-validation folds is specified with the argument M.

If validation="loo", leave-one-out cross-validation is performed by calling the loo function. In this case the arguments folds and M are ignored.

The estimation of the missing values can be performed by the reconstitution of the data matrix using the nipals function. Otherwise, missing values are handled by casewise deletion in the rcc function.

Value

The returned value is a list with components:

opt.lambda1,
opt.lambda2

value of the parameters of regularization on which the cross-validation method reached it optimal.

opt.score

the optimal cross-validation score reached on the grid.

grid1, grid2

original vectors grid1 and grid2.

mat

matrix containing the cross-validation score computed on the grid.

Author(s)

Sébastien Déjean and Ignacio González.

See Also

image.tune.rcc and http://www.mixOmics.org for more details.

Examples

1
2
3
4
5
6
7
8
9
data(nutrimouse)
X <- nutrimouse$lipid
Y <- nutrimouse$gene

## this can take some seconds
## Not run: 
tune.rcc(X, Y, validation = "Mfold")

## End(Not run)

Example output

Loading required package: MASS
Loading required package: lattice
Loading required package: ggplot2

Loaded mixOmics 6.3.1

Visit http://www.mixOmics.org for more details about our methods.
Any bug reports or comments? Notify us at mixomics at math.univ-toulouse.fr or https://bitbucket.org/klecao/package-mixomics/issues

Thank you for using mixOmics!
Warning messages:
1: In rgl.init(initValue, onlyNULL) : RGL: unable to open X11 display
2: 'rgl_init' failed, running with rgl.useNULL = TRUE 
3: .onUnload failed in unloadNamespace() for 'rgl', details:
  call: fun(...)
  error: object 'rgl_quit' not found 
  lambda1 =  0.5005 
  lambda2 =  0.001 
 CV-score =  0.5444805 

mixOmics documentation built on June 1, 2018, 5:06 p.m.

Related to tune.rcc in mixOmics...