My read of "help cvlasso" is that e(varXmodel) should contain only variables chosen by cvlasso. However, it keep returning all of the variables, despite only a subset being chosen. Example of issue below (meaningly empirical example). Has anyone experienced this? Alternatively, does anyone have another way to get the selected variables (to be used elsewhere as variables in a regression)?
Thank you!
CODE:
local coeffs "total_duration max_duration tmmx tmmn vs sph pr mvs_10m snwd_s snow_s awnd_s wsf2_s wsf5_s"
local conditions "fe nf(5) lc(150) seed(1234)"
local sv "lse"
local estsample_dum "year>2015&year<2021&rand<=.8"
cvlasso cmi_dum `coeffs', `conditions' `sv', if `estsample_dum'&rand<.1
RESULTS:
K-fold cross-validation with 5 folds. Elastic net with alpha=1.
Fold 1 2 3 4 5
| Lambda MSPE st. dev.
----------+---------------------------------------------
1| 5380.1722 .06756452 .00049734
...cut...
14| 2408.8119 .06663226 .00047482 ^
...cut...
88| 24.84424 .06617284 .00047316 *
...cut...
* lopt = the lambda that minimizes MSPE.
Run model: cvlasso, lopt
^ lse = largest lambda for which MSPE is within one standard error of the minimal MSPE.
Run model: cvlasso, lse
Estimate lasso with lambda=2408.812 (lse).
---------------------------------------------------
Selected | Lasso Post-est OLS
------------------+--------------------------------
max_duration | 0.0437135 0.0838706
vs | 0.0008427 0.0071744
sph | 1.5681662 4.9519355
wsf5_s | 0.0003178 0.0003982
---------------------------------------------------
. dis e(varXmodel)
total_duration max_duration tmmx tmmn vs sph pr mvs_10m snwd_s snow_s awnd_s wsf2_s wsf5_s
. dis e(varX)
total_duration max_duration tmmx tmmn vs sph pr mvs_10m snwd_s snow_s awnd_s wsf2_s wsf5_s
. dis e(partial)
.
Related Posts with Getting selected variables from cvlasso
lead (t+1) variablesDearest All I am confronting an issue I have a dataset which consists of 10574 observations panning…
Exporting a file with a list of variable names and variable labels.Hi all, I've been trying to export a file (Excel or anything) with two columns - first with a list o…
Annualize monthly returnsDear Statalist users, I would like to annualize monthly returns on funds by using the following for…
Generate random data with mean, std and rangeSo my professor is asking us to produce some data from a experimental paper to do power analysis. So…
Three way interaction without significant two way interaction?Hello, Does anyone know if it is legitimate to proceed with threeway interactions when the two-way …
Subscribe to:
Post Comments (Atom)
0 Response to Getting selected variables from cvlasso
Post a Comment