Hello folks,
I am trying to execute Joseph Coveney's excellent answer to this question in my own code: https://www.statalist.org/forums/for...tic-regression
I am trying to:
1. Fit a logit model via lasso, and store the selected variables in a global called selvars,
2. fit a firthlogit using this global and store the matrix e(b) as B for later use
3. quietly logit the same model, using the from() option (with the aim of subsequently using some postestimation commands)
No matter what I do, I am getting a "varlist not allowed" error in the third step. If I remove the from() option the code does run, but obviously this is not what I am after.
A reproducible example is below, the final line draws the error. Many thanks!
I am trying to execute Joseph Coveney's excellent answer to this question in my own code: https://www.statalist.org/forums/for...tic-regression
I am trying to:
1. Fit a logit model via lasso, and store the selected variables in a global called selvars,
2. fit a firthlogit using this global and store the matrix e(b) as B for later use
3. quietly logit the same model, using the from() option (with the aim of subsequently using some postestimation commands)
No matter what I do, I am getting a "varlist not allowed" error in the third step. If I remove the from() option the code does run, but obviously this is not what I am after.
A reproducible example is below, the final line draws the error. Many thanks!
Code:
*ssc install firthlogit sysuse auto lasso logit foreign price mpg rep78 headroom trunk weight di e(othervars_sel) global selvars = e(othervars_sel) firthlogit foreign $selvars matrix define B = e(b) matrix list B quietly logit foreign ``selvars'', asis iterate(0) from(`B', copy) nolog
Comment