Announcement

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

  • Interaction Terms in 2sls

    Dear Users,

    This is my first post in Statalist. I am trying to use 2sls with a Dummy Interaction Term in unbalanced Panel Data with 183 groups and 10 years. Before going for 2sls, I ran the -xtreg, fe- command with my following equation, whereby Depvar is a continuous variable, Dummy_change is a dummy variable with value 0 (for before cahnge) and 1(for after change), Indepvar_1 is a dummy variable with value 0 (no) and 1 (yes), and Indepvar_2 is a continuous variable:

    Code:
    xtreg Depvar i.Dummy_change#(i.Indepvar_1 c.Indepvar_2) controlvars Dummy_change i.Year i.Industry, fe vce(cluster ID)
    This equation gives at least two outcomes (one for 'before change' and another for 'after change') for the Indepvars (1 and 2) as interacted with Dummy_change. After that when I ran the same with -xtivreg, fe- instead of -xtreg, fe vce(cluster ID)-, it said, "no interactions are allowed as depvars". Then I searched the internet and found that I need to generate new var with interaction terms. Therefore, I generated the following interaction terms:
    Code:
    g dc_iv1 = Dummy_change#i.Indepvar_1
    Code:
    g dc_iv2 = Dummy_change#c.Indepvar_2
    and ran the following command:
    Code:
    xtivreg Depvar (dc_iv1 dc_iv2 = i.Dummy_change#(i.L2.Indep_1 c.L2.Indep_2) controlvars Dummy_change i.Year i.Industry) controlvars Dummy_change i.Year i.Industry, fe
    But the outcomes of the variables dc_iv1 dc_iv2 are shown for the whole sample, unlike -xtreg, fe- that produced two outcomes for each of the Indepvars (one for 'before change' and another for 'after change'). Please note, endogeneous variables (dc_iv1 and dc_iv2); instrumental variables (i.Dummy_change#(i.L2.Indep_1 c.L2.Indep_2) controlvars Dummy_change i.Year i.Industry); second lag of Indepvars were considered as instruments.
    Could you please help me in this regard so as to get results for both 'before' and 'after' change with a single equation? I am using Stata 12.1 special edition and installed xtivreg into it.
    Last edited by Tariqul Islam; 04 Mar 2019, 11:10.

  • #2
    You didn't get a quick answer. You'll increase your chances of a useful answer by following the FAQ on asking questions - provide Stata code in code delimiters, readable Stata output, and sample data using dataex. Knowing precisely what you entered and precisely what Stata gave back is essential to diagnosing your problem. With data-related problems, being able to replicate the problem can be essential.

    When you do interactions in xtivreg, you need to create all the interaction values you need before the xtivreg. I suspect you need to create four variables to have the four parameters you get in xtreg. Do a g d=Indepvar_1 if Dumm=0, then another if Dumm=1, and do the same for the second one.

    Comment

    Working...
    X