Lambda.sel | R Documentation |
Use out-of-sample Root Mean Square Error to select the penalty parameter of LASSO-type linear regression.
Lambda.sel(X, y, newX, newY, family = "gaussian", alpha = 1)
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. |
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.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.