# State space with lasso

Is it possible to incorporate lasso variable selection in the high dimensional state space model. If yes, is there any code or package available in R

There are 2 packages in R (to my knowledge) that allow you to use LASSO variable selection.

Package 1: glmnet

Package 2: lars

How to use it?

1. glmnet function

General: glmnet(x, y, family=c("gaussian","binomial","poisson","multinomial","cox","mgaussian"), weights, offset=NULL, alpha = 1, nlambda = 100, lambda.min.ratio = ifelse(nobs))

Your case: x is an input matrix, y is a response, alpha = 1 means it is using LASSO method. If you set alpha = 0 it will use Ridge Regularization method.

1. lars function

General: lars(x, y, type = c("lasso", "lar", "forward.stagewise", "stepwise"), trace = FALSE, normalize = TRUE, intercept = TRUE, Gram, eps = .Machine\$double.eps, max.steps, use.Gram = TRUE) 

Your case: lars(x, y, type = lasso) where x is a matrix of predictors, and y is a response.

• Welcome to our site. The interest in this question is not in the code request, but in incorporating Lasso in a high-dimensional state-space model. How would you propose doing that? – whuber Jan 12 at 19:29