mylars {parcor}R Documentation

Cross-validation for Lasso

Description

This function computes the cross-validation-optimal regression coefficients for lasso.

Usage

mylars(X, y, k = 10,use.Gram=TRUE,normalize=TRUE)

Arguments

X matrix of observations. The rows of X contain the samples, the columns of X contain the observed variables
y vector of responses. The length of y must equal the number of rows of X
k the number of splits in k-fold cross-validation. Default is k=10.
use.Gram When the number of variables is very large, you may not want LARS to precompute the Gram matrix. Default is use.Gram=TRUE.
normalize Should the columns of X be scaled? Default is normalize=TRUE.

Details

We use the glmnet() function from the glmnet package to compute the fit. Note that in Kraemer et. al. (2009), we used the lars() function from the lars package, which is much slower than glmnet().

Value

lambda vector of paramter values from which the optimal parameter is selected
cv cross-validated error for all lambda values
lambda.opt cross-validation optimal parameter
cv.lasso cv error for the optimal model.
intercept cross-validation optimal intercept
coefficients cross-validation optimal regression coefficients, without intercept

Author(s)

Nicole Kraemer

References

R. Tibshirani (1997) "Regression Shrinkage and Selection via the Lasso", Journal of the Royal Statistical Society B, 58 (1)

N. Kraemer, J. Schaefer, A.-L. Boulesteix (2009) "Regularized Estimation of Large-Scale Gene Regulatory Networks with Gaussian Graphical Models", BMC Bioinformatics, 10:384

http://www.biomedcentral.com/1471-2105/10/384/

See Also

Beta2parcor, adalasso

Examples


n<-20
p<-50
X<-matrix(rnorm(n*p),ncol=p)
y<-rnorm(n)
dummy<-mylars(X,y)


[Package parcor version 0.2-2 Index]