LARS: Run a lars / lasso / elasticNet regression

Description Usage Arguments Details Value Examples

View source: R/RcppExports.R

Description

Run a lars/lasso/elasticNet regression

Usage

1
LARS(matX, vecY, lambda1, lambda2, useCholesky = FALSE, testX = NULL)

Arguments

matX

A matrix of explanatory variables, i.e. regressors

vecY

A vector with the target variable

lambda1

A doube with l1-norm penalty regularization parameter

lambda2

A doube with l2-norm penalty regularization parameter

useCholesky

A logical value indicating whether to use the Cholesky

testX

A optional matrix of test values to validate prediction decomposition when solving the linear system, else full Gram matrix is used.

Details

This function performs a lars, lasso or elastic net regression.

Value

A list with estimated coefficient, the value of lambda1 after each iteration and the predicted values, either from the training data or, if supplied, the test set.

Examples

1
2
3
4
## LARS demo data set from MLPACK with limited rank
data(lars)
fit1 <- LARS(matX = lars_dependent_x, vecY = lars_dependent_y, 0.1, 0.1, FALSE)
fit2 <- LARS(matX = lars_dependent_x, vecY = lars_dependent_y, 0.1, 0.1, TRUE)

eddelbuettel/rcppmlpack2 documentation built on Feb. 2, 2021, 1:51 a.m.