I am currently using dsregress to estimate a double-selection lasso linear regression using Stata 16.
My variables of interest are interaction terms between two categorical variables, let's call them i.x1 (i=0,1,2) and i.x2 (i=1-7). Ideally, I want to estimate the coefficients of these interaction terms, while allowing lasso to select among a vast set of controls Z. Something like:
Code:
dsregress y i.x1#i.x2 , controls(i.x2 Z i.x2#Z)
If I estimate this model only for x1, it works just fine, as x2 is allowed to be included in Z
Code:
dsregress y i.x1 , controls(i.x2 Z i.x2#Z)
Code:
dsregress y i.x1#i.x2 , controls(Z)
My question is, how can I estimate the coefficients for the interaction terms i.x1#i.x2 , while including i.x2 and interactions i.x2#Z in the set of controls?
If I try to do this
Code:
dsregress y i.x1##i.x2 , controls(i.x2 Z i.x2#Z)
i.x2 cannot be specified both in varsofinterest and controls
I do not need the coefficients for i.x2, and if I try to estimate
Code:
dsregress y i.x1 i.x1#i.x2 , controls(i.x2 Z i.x2#Z)
Is there a way around this?
Many thanks in advance.
0 Response to Double selection lasso with interaction terms as vars of interest
Post a Comment