easyLASSO: Select and fit sparse linear model with LASSO

Description Usage Arguments Value See Also Examples

Description

The purpose of this function is to make the process of LASSO modelling as simple as possible.

This is a simple wrapper on two glmnet functions which, when given input matrix X and response vector y, and a criterion for model selection, will estimate the lambda parameter, and return the LASSO results as a glmnet model. This model can then be used to find coefficients and predictions.

Usage

1
easyLASSO(X, y, criterion = "lambda.1se")

Arguments

X

Predictor matrix, nXp, with n observations and p features.

y

Response vector, or column or row matrix. Must have length n.

criterion

String describing which lambda criterion to use in selecting a LASSO model. Choices currently are c("lambda.1se","lambda.min").

Value

a glmnet model

See Also

glmnet and cv.glmnet

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
set.seed(1)
nObs <- 100
X <- distMat(nObs,6)
A <- cbind(c(1,0,-1,rep(0,3)))
  # Y will only depend on X[,1] and X[,3]
Y <- X %*% A + 0.1*rnorm(nObs)
lassoObj <- easyLASSO(X=X,y=Y) # LASSO fitting
Yhat <- predict(lassoObj,newx=X)
yyHatPlot(Y,Yhat)
coef( lassoObj ) # Sparse coefficients
coefPlot( lassoObj )


Search within the expandFunctions package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.