I am trying to estimate a adalasso model used in the paper: [https://www.econ.puc-rio.br/mgarcia/170424realtimeinflationforecasting.pdf](Real-time inflation forecasting with high-dimensional models: The case of Brazil)
To estimate a adalasso, the first step is to estimate the coefficients using a Lasso model and then compute a penalty factor for each variable.
The glmnet function from glmnet package has an argument "penalty.factor" that allows a penalty factor for each variable.
However, using tidymodel, the model spec allows only a single number on penalty, for example:
model.spec <-
linear_reg(penalty = 0.1, mixture = 1) %>%
set_engine("glmnet")
I tried to modify it to the following:
model.spec <-
linear_reg(mixture = 1) %>%
set_engine("glmnet", penalty.factor = penalty.factor.ada)
but I got the same error:
Error in `.check_glmnet_penalty_fit()`:
! For the glmnet engine, `penalty` must be a single number (or a value of `tune()`).
• There are 0 values for `penalty`.
• To try multiple values for total regularization, use the tune package.
• To predict multiple penalties, use `multi_predict()`
Any ideas how to estimate Adalasso using tidymodels package??