Lambda.sel: Select the Penalty Parameter of LASSO-type Linear Regression

Lambda.selR Documentation

Select the Penalty Parameter of LASSO-type Linear Regression

Description

Use out-of-sample Root Mean Square Error to select the penalty parameter of LASSO-type linear regression.

Usage

Lambda.sel(X, y, newX, newY, family = "gaussian", alpha = 1)

Arguments

X

Matrix of predictors of the estimation sample.

y

Dependent variables of the estimation sample.

newX

Design matrix in the forecasting subsample.

newY

Dependent variable in the forecasting subsample.

family

Response type. See the glmnet command in R. Possible types are "gaussian", "binomial", "poisson", "multinomial", "cox", "mgaussian". Default is "gaussian".

alpha

The elasticnet mixing parameter, with 0 ≤q α ≤q 1. See the glmnet command in R. Default value is 1.

Value

A list containing:

  • lambda.min - lambda that achieves the minimum mean square error.

  • beta - estimated coefficients for lambda.min.

  • mse - mean squared error.

  • lambda - the actual sequence of lambda values used.

Examples

X <- cbind(rnorm(200),rnorm(200,2,1),rnorm(200,4,1))
y <- rnorm(200)
newX <- cbind(rnorm(200),rnorm(200,2,1),rnorm(200,4,1))
newy <- rnorm(200)
output <- Lambda.sel(X, y, newX, newy)

SLBDD documentation built on April 27, 2022, 5:08 p.m.

Related to Lambda.sel in SLBDD...