Learn R Programming

Compositional (version 1.1)

alfaridge.tune: Cross validation for the ridge regression with compositional data as predictor using the $\alpha$-transformation

Description

Cross validation for the ridge regression is performed using the TT estimate of bias (Tibshirani and Tibshirani, 2009). There is an option for the GCV criterion which is automatic. The predictor variables are compositional data and the $\alpha$-transformation is applied first.

Usage

alfaridge.tune(y, x, M = 10, a = seq(-1, 1, by = 0.1), lambda = seq(0, 2, by = 0.1),
seed = FALSE, ncores = 2, graph = TRUE, col.nu = 15)

Arguments

y
A numeric vector containing the values of the target variable. If the values are proportions or percentages, i.e. strictly within 0 and 1 they are mapped into R using the logit transformation.
x
A numeric matrix containing the compositional data, i.e. the predictor variables.
M
The number of folds. Set to 10 by default.
a
A vector with the a grid of values of $\alpha$ to be used.
lambda
A vector with the a grid of values of $\lambda$ to be used.
seed
A boolean variable. If it is TRUE the results will always be the same.
ncores
The number of cores to use. If it is more than 1 parallel computing is performed.
graph
If graph is TRUE (default value) a filled contour plot will appear.
col.nu
A number parameter for the filled contour plot, taken into account only if graph is TRUE.

Value

  • If graph is TRUE a fileld contour a filled contour will appear. A list including:
  • mspeThe MSPE where rows correspond to the $\alpha$ values and the columns to the number of principal components.
  • best.parThe best pair of $\alpha$ and $\lambda$.
  • performanceThe minimum mean squared error of prediction (bias corrected) and the estimated bias.

Details

A k-fold cross validation is performed and the estimated performance is bias corrected as suggested by Tibshirani and Tibshirani (2009).

References

Hoerl A.E. and R.W. Kennard (1970). Ridge regression: Biased estimation for nonorthogonal problems. Technometrics, 12(1):55-67. Brown P. J. (1994). Measurement, Regression and Calibration. Oxford Science Publications. Tibshirani R.J., and Tibshirani R. (2009). A bias correction for the minimum error rate in cross-validation. The Annals of Applied Statistics 3(2): 822-829. Tsagris M.T., Preston S. and Wood A.T.A. (2011). A data-based power transformation for compositional data. In Proceedings of the 4th Compositional Data Analysis Workshop, Girona, Spain. http://arxiv.org/pdf/1106.1451.pdf

See Also

alfa.ridge, ridge.tune

Examples

Run this code
library(MASS)
y <- fgl[, 1]
x <- fgl[, 2:9]
alfaridge.tune(y, x, M = 10, a = seq(0.1, 0.5, by = 0.1), lambda = seq(0.1, 1, by = 0.2),
seed = FALSE, ncores = 1, graph = TRUE, col.nu = 15)

Run the code above in your browser using DataLab