Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to get controls selected for the variables of interest using lasso for inference

    I run a lasso for inference model using double selection:

    dsregress depvar i.variable_of_interest1 i.variable_of_interest2, controls($cont i.($cat)) rseed(12345)

    And store the estimates:
    estimates store ds_plugin

    I can look at the controls selected for the dependent variable:
    lassocoef(ds_plugin, for (dapvar))

    What I would like to do is look at the controls selected for the variables of interest - so at the moment I am writing:
    lassocoef(ds_plugin, for (variable_of_interest1))

    However I get an error with this:

    can not find result for variable_of_interest1
    r(111)

    I am inputting the same code as in the lasso manual so am unsure why it is not working for me. If anyone could explain that would be really helpful


  • #2
    You use factor variable notation to include the full set of categories less one. So with k levels of var

    Code:
    i.var
    results in k-1 variables. So your syntax

    lassocoef(ds_plugin, for (variable_of_interest1))
    makes no sense as lassocoef expects one variable. In any case, you can view how each level is named using

    Code:
     di e(varsofinterest)

    Comment


    • #3
      Thank you for explaining

      Comment

      Working...
      X