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
Help trying to determine an Asymmetric effect for dummy variables in a Linear Random Effects ModelHello this is my first post here. So I am making a model to try and show the asymmetric effect in m…
Coefplot - multiple models with different dependent variablesAll, I am running multiple regressions with the same independent variable and 29 different dependent…
Reshape wide with no time/order variableHello. I am working with a dataset that has multiple observations for most of the identifiers labele…
Creating a Dummy variable (Time variant )Dear All, 1. I want to create a Dummy Variable ( Health Status of Indivuduals) which is either yes …
covariates and distal outcomes in a latent class modelHi Statalist Is there a way to implement the 3-step Latent Class Analysis (to include the covariates…
Subscribe to:
Post Comments (Atom)
0 Response to How to extract selected features from LASSO in stata
Post a Comment