Learn R Programming

VDA (version 1.01)

cv.VDA_LE: Choose the optimal pair of lambdas, $\lambda_1$ and $\lambda_2$

Description

Use k-fold validation to choose the optmial values for the tuning parameters $\lambda_1$ and $\lambda_2$ to be used in Multicategory Vertex Discriminant Analysis (VDA_LE).

Usage

cv.VDA_LE(x, y, kfold, lam.vec.1, lam.vec.2)

Arguments

x
n x p matrix or data frame containing the cases for each feature. The rows correspond to cases and the columns to the features. Intercept column is not included in this.
y
n x 1 vector representing the outcome variable. Each element denotes which one of the k classes that case belongs to.
kfold
The number of folds to use for the k-fold validation for each set of $lambda_1$ and $lambda_2$
lam.vec.1
A vector containing the set of all values of $\lambda_1$, from which VDA will be conducted.
lam.vec.2
A vector containing the set of all values of $\lambda_2$, from which VDA will be conducted. VDA_LE is relatively insensitive to lambda values, so it is recommended that a vector of few values is used. The default value is 0.01.

Value

  • kfoldThe number of folds used in k-fold cross validation
  • lam.vec.1The user supplied vector of $\lambda$_1 values
  • lam.vec.2The user supplied vector of $\lambda$_2 values
  • error.cvA matrix of average testing errors. The rows correspond to $\lambda$_1 values and the columns correspond to $\lambda$_2 values.
  • lam.optThe pair of $\lambda$_1 and $\lambda$_2 values that return the lowest testing error across k-fold cross validation.

Details

For each pair of $(\lambda_1,\lambda_2)$, k-fold cross-validation will be conducted and the corresponding average testing error over the k folds will be recorded. $\lambda_1$ represents the parameter for the lasso penalization, while $\lambda_2$ represents the parameter for the group euclidean penalization. The optimal pair is considered the pair of values that give the smallest testing error over the cross validation.

References

Wu, T.T. and Lange, K. (2010) Multicategory Vertex Discriminant Analysis for High-Dimensional Data. Annals of Applied Statistics, Volume 4, No 4, 1698-1721.

Lange, K. and Wu, T.T. (2008) An MM Algorithm for Multicategory Vertex Discriminant Analysis. Journal of Computational and Graphical Statistics, Volume 17, No 3, 527-544.

See Also

VDA_LE.

Examples

Run this code
# load data
data(zoo)

# feature matrix without intercept
x <- zoo[,2:17]

# class vector
y <- zoo[,18]

# lambda vector
lam.vec.1 <- log(2:4)/100
lam.vec.2 <- (1:3)/100

# searching for the best pair
lambda <- cv.VDA_LE(x, y, kfold=3, lam.vec.1, lam.vec.2)$lam.opt

# run VDA
out <- VDA_LE(x,y,lambda[1], lambda[2])

Run the code above in your browser using DataLab