Hi,
I have somewhat of a basic question. I am running the lasso linear command and wanted to use that to extract the selected variables and then use them for another estimation.
From what I can tell, I am interested in extracting e(post_sel_vars). However, since I am an R user, I don't know how to extract the vector of variables selected (please note that I am not interested in the coefficients but rather the variable names).
This is what I have right now (the parts highlighted in bold are wrong):
foreach var in $outcome_vars {
lasso linear `var' (i.report_month i.report_year i.tehsil_level i.ao) $ability_vars $network_vars $agsmart_indicators $interactions , selection(adaptive) cluster(end_tehsil) noconstant
//ereturn list
local selected_vars = e(post_sel_vars)
//lassocoef lassoadaptive, display(coef, standardized)
xtreg `var' subplus `selected_vars', i(ao) nonest fe
}
Any help would be greatly appreciated!
Thanks,
Bhavya
Related Posts with How to extract selected features from LASSO in stata
Dealing with weights stata.In SPSS, when activate the weight variable, the data case number get multiplied by number in weight …
append 65.000 .csv filesI have 8 folders and in every forlder I have 35042 .csv files. I would like to import and append al…
What tests to perform on a Panel Data set?Hello, I have a panel data set of 4500 firms for the years 2000 - 2017 (around 42,000 firm-year obs…
Storing coefficients when running same regression for different sampleDear Statalisters; I need to run the same regression for 5000 different samples. I have a separate …
rlaplace(m,b) command not workingHi, I would like to generate a random variable according to the laplace distribution. The command '…
Subscribe to:
Post Comments (Atom)
0 Response to How to extract selected features from LASSO in stata
Post a Comment