xuyiqing / gsynth

Generalized Synthetic Control Method
Other
131 stars 40 forks source link

Is it possible to include interaction term with categorical variables in X? #48

Open ShunyuanZ opened 3 years ago

ShunyuanZ commented 3 years ago

I have two categorial variables M1, M2, I wanted to add M1 * M2 as a control variable. Yet, it does not seem to work with categorical variable interactions. Creating many dummy variables might be my last option... Any thoughts? Thanks!

xuyiqing commented 3 years ago

Yes, you probably need to create those dummies. Note that including lots of controls will inevitably make the algorithm run more slowly.

On Wed, Oct 14, 2020 at 8:28 AM ShunyuanZ notifications@github.com wrote:

I have two categorial variables M1, M2, I wanted to add M1 * M2 as a control variable. Yet, it does not seem to work with categorical variable interactions. Creating many dummy variables might be my last option... Any thoughts? Thanks!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/xuyiqing/gsynth/issues/48, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB2PKGCMD24QQJFVBO3C25DSKW7SLANCNFSM4SQYN2DQ .

-- Yiqing Xu

Assistant Professor Department of Political Science Stanford University http://yiqingxu.org/

ShunyuanZ commented 3 years ago

Yes, you probably need to create those dummies. Note that including lots of controls will inevitably make the algorithm run more slowly. On Wed, Oct 14, 2020 at 8:28 AM ShunyuanZ @.**> wrote: I have two categorial variables M1, M2, I wanted to add M1 M2 as a control variable. Yet, it does not seem to work with categorical variable interactions. Creating many dummy variables might be my last option... Any thoughts? Thanks! — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#48>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB2PKGCMD24QQJFVBO3C25DSKW7SLANCNFSM4SQYN2DQ . -- Yiqing Xu Assistant Professor Department of Political Science Stanford University http://yiqingxu.org/

Thanks! Will try. I tested it with M1*M2 but then got a error "In chol.default(mat, pivot = TRUE, tol = tol) : the matrix is either rank-deficient or indefinite"