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
Error message "invalid 'Drive'" when using spwmatrixHi all, I am trying to import a Geoda-generated .gal file into Stata and export it as a .txt file. …
converting agregate data to individual data DAuid tot_pop tot_male 0_4male 5_9male 10_14male 15_19male 20_24male 25_29male 30_34male 35_3…
Help summing data for men and womenHi, I have data on the number of people of each age in each local authority. The problem at the mome…
help with string variable comprising multiple linesHi Statalist, After importing from Excel (-import excel-; .xlsx), I have some string variable value…
Download STATA 15 SE 64 Bit Full VersionDownload STATA 15 SE 64 Bit Full Version …
Subscribe to:
Post Comments (Atom)
0 Response to Getting selected variables from cvlasso
Post a Comment