Announcement

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

  • Interactions in instrumental variable regression

    Hi statalist,
    I am using ivreg2 to carry out my instrumental variable analysis.

    This is my model without any interactions with endogenous variable ‘’currwork’’. I am using three instruments.
    Code:
    ivreg2 emotional (currwork=child3 hheligwomen_w avgwork) i.husjob2 i.ehypo i.ehyper dis i.educlvl i.decision attitude[pw=weight1]
    This is my model with the inclusion of an interaction between currwork and husjob2.
    Code:
    ivreg2 emotional (i.currwork#i.husjob2=child3 hheligwomen_w avgwork) i.husjob2 i.ehypo i.ehyper dis i.educlvl i.decision attitude  [pw=weight1]

    My questions are:
    1. Am I correctly entering the interaction in model 2? I am aware I am omitting one of the main effects (currwork) - I am wondering about whether including the interaction within brackets is the correct way to interact your endogenous variable with another variable.
    2. In Model 1, the adequacy of my IV is confirmed using the under identification test, cragg Donald F stat and the Hansen J statistic. However, once I include the interaction in Model 2 the results of these tests change (indicating that my IV’s are not adequate anymore). I am unsure why this might be the case?
    3. Is the kleibergen-Paap rk LM statistic reported using ivreg the same as the Anderson canonical correlations test?
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input byte currwork float(husjob2 child3) byte hheligwomen_w float avgwork
    1 0 0 1 2.530864
    1 0 0 1 2.530864
    0 2 0 1 2.530864
    0 2 0 1 2.530864
    0 0 0 1 2.530864
    0 0 0 1 2.530864
    1 0 0 1 2.530864
    0 0 1 1 2.530864
    1 2 0 1 2.530864
    0 0 0 1 2.530864
    0 0 0 1 2.530864
    0 1 0 1 2.530864
    1 0 0 1 2.530864
    0 2 0 2 2.530864
    0 0 1 1 2.530864
    0 2 0 1 2.530864
    0 2 0 1 2.530864
    1 0 0 1 2.530864
    0 0 0 1 2.530864
    0 2 0 1 2.530864
    1 0 0 1 2.530864
    0 0 0 1 2.530864
    0 0 0 1 2.530864
    1 0 0 1 2.530864
    1 0 0 1 2.530864
    0 0 0 1 2.530864
    0 0 0 1 2.530864
    0 0 0 1 2.530864
    0 2 0 1 2.530864
    0 2 1 1 2.530864
    0 2 0 1 2.530864
    0 2 0 1 2.530864
    1 2 1 1 2.530864
    0 2 0 1 2.530864
    1 0 0 1 2.530864
    1 0 0 1 2.530864
    0 0 0 1 2.530864
    1 0 0 1 2.530864
    1 0 0 1 2.530864
    1 0 0 1 2.530864
    0 2 0 1 2.530864
    0 0 0 1 2.530864
    1 0 1 1 2.530864
    0 2 0 1 2.530864
    0 2 0 1 2.530864
    1 0 0 1 2.530864
    0 2 0 1 2.530864
    0 0 0 1 2.530864
    0 2 1 1 2.530864
    0 0 0 1 2.530864
    0 2 0 1 2.530864
    0 2 0 1 2.530864
    0 2 0 1 2.530864
    0 2 0 1 2.530864
    0 2 0 1 2.530864
    0 0 0 1 2.530864
    1 0 0 1 2.530864
    0 2 0 1 2.530864
    0 2 0 1 2.530864
    0 2 0 1 2.530864
    0 2 0 1 2.530864
    0 2 0 1 2.530864
    0 2 0 1 2.530864
    1 0 0 1 2.530864
    1 0 0 1 2.530864
    1 2 0 1 2.530864
    0 0 0 1 2.530864
    1 0 0 1 2.530864
    0 2 0 1 2.530864
    0 0 0 1 2.530864
    1 0 0 1 2.530864
    0 0 0 1 2.530864
    0 0 0 1 2.530864
    0 1 0 2 2.530864
    0 2 0 1 2.530864
    0 1 0 1 2.530864
    1 0 0 1 2.530864
    1 1 0 1 2.530864
    0 0 0 1 2.530864
    1 2 0 1 2.530864
    0 2 0 1 2.530864
    0 2 0 1 2.530864
    1 1 0 1 2.530864
    0 1 0 2 2.530864
    0 2 0 2 2.530864
    0 0 0 1 2.530864
    0 2 0 1 2.530864
    0 0 1 1 2.530864
    0 2 0 1 2.530864
    0 0 1 1 2.530864
    0 2 1 1 2.530864
    0 2 0 1 2.530864
    1 2 1 1 2.530864
    0 2 0 1 2.530864
    1 0 0 1 2.530864
    0 0 0 1 2.530864
    0 0 0 1 2.530864
    0 2 0 1 2.530864
    0 0 0 1 2.530864
    1 0 0 1 2.530864
    end
    label values currwork CURRWORK
    label def CURRWORK 0 "no", modify
    label def CURRWORK 1 "yes", modify
    label values husjob2 hj1
    label def hj1 0 "White collar", modify
    label def hj1 1 "Unemployed", modify
    label def hj1 2 "Blue collar job", modify

  • #2
    If you had tried running the model, you would have learned that that ivreg2 doesn't accept factor variable notation on the lhs statement for the instrumental variables. It behooves you to try to run your model before asking about it.

    Comment


    • #3
      Thank you for your response Phil. However, I have run these Models and they do in fact return results when using factor notation. Please see the following: https://www.statalist.org/forums/for...pdate-v-4-1-01 - ivreg2 has been updated to accommodate factor notation.

      Comment


      • #4
        Hi Lara:

        I have a section on this in the second edition of my MIT Press book, Chapter 9. What you need to do, at a minimum, is to create extra IVs for the interaction term. The natural thing to do is to interact each of child3 hheligwomen_w avgwork with husjob2. These likely will be much stronger IVs for the interaction then simply using the same three IVs you used for the first model.

        I didn't know ivreg2 had been updated to allow factor notation! Not sure the same is true of ivregress, but I haven't looked at Stata 16 yet. In any case, it's easy to construct the extra three interactions. My hunch is that when you look at the two first stages you'll find the interactions are stronger for currwork*husjob2 than the levels of the IVs.

        Oh, and it appears from the above that you know this, but don't try to do this "by hand," as plugging in fitted values into the interactions is generally inconsistent. Simply add the three IVs constructed as I stated to the list of IVs. Everything should work out.

        I hope this helps.
        Jeff

        Comment


        • #5
          Thank you Jeff for taking the time to explain. If I may double check that I have understood you correctly, would the second model (with the interaction) look something along these lines:

          Code:
          ivreg2 emotional (i.currwork#i.husjob2=child3#husjob2 hheligwomen_w#husjob2 c.avgwork#husjob2) i.husjob2 i.ehypo i.ehyper dis i.educlvl i.decision attitude parentdv presentdv presentdva health i.wealthq i.union1more age i.agegapcat i.religion i.urban i.geo_eg1988_2014 ratio ratio1 i.year [pw=weight1]
          I interacted each of my IV's with husjob2. The coefficients on my interaction term currwork#husjob2 seem much more sensible now.

          Comment


          • #6
            Yes, that looks correct to me. Glad that seems to have worked out. And I'll have to remember that ivreg2 now supports factor notation!

            Comment


            • #7
              Thank you very much!

              Comment


              • #8
                Hi everyone,

                Some of you know if the factor notation is supported in "XTIVREG2" which is the panel-data version of "IVREG2". Thanks!

                Comment


                • #9
                  Just install it, and check.

                  Why does anybody (including yourself) have to remember something that you can check in 10sec?

                  Originally posted by JuanD Salazar View Post
                  Hi everyone,

                  Some of you know if the factor notation is supported in "XTIVREG2" which is the panel-data version of "IVREG2". Thanks!

                  Comment


                  • #10
                    You're right. It's not supported.

                    Comment


                    • #11
                      Also the regression in #5 might, or might not be correct.

                      The general rule of the expansion that Original Poster is looking for (explained at various place by Professor Wooldridge say) is that if you start from

                      ivreg Y (X = Z1 Z2) W

                      and you want to consider the interaction of X and W, you go to

                      ivreg Y (X X*W = Z1 Z2 Z1*W Z2*W) W

                      whether this regression achieves this

                      Code:
                      ivreg2 emotional (i.currwork#i.husjob2=child3#husjob2 hheligwomen_w#husjob2 c.avgwork#husjob2) i.husjob2 i.ehypo i.ehyper dis i.educlvl i.decision attitude parentdv presentdv presentdva health i.wealthq i.union1more age i.agegapcat i.religion i.urban i.geo_eg1988_2014 ratio ratio1 i.year [pw=weight1]
                      has a question mark on it.

                      Comment


                      • #12
                        I did not know this, and I did not mean this.

                        What I meant is that there are hundreds of thousands of commands in Stata, and what they accept and how they operate changes often times.

                        Neither I, nor you, nor anybody else should fill their head with what the hundreds of thousands of commands accept at a given point in time. We just try it, and if works good, if it does not, we look for another solution.

                        In your case the other solution might be to just use -ivreg2-. Last time I checked, -ivreg2- was doing pretty much everything that -xtivreg2- is supposed to do.

                        Originally posted by JuanD Salazar View Post
                        You're right. It's not supported.

                        Comment


                        • #13
                          HI everyone

                          I have been trying to run a code just like yours


                          HTML Code:
                          xtivreg AMENAZAS_POB (FLUJO2_0=N_DISTANCIA I.FECHA N_DISTANCIA#I.FECHA)   POBLACION PROP_HOMBRES_15_60 , fe first vce( cluster CODMUNI)
                          but it have been around 2 hours and i don’t get my results, i'm doing something wrong?

                          Comment


                          • #14
                            Originally posted by Joro Kolev View Post
                            Also the regression in #5 might, or might not be correct.

                            The general rule of the expansion that Original Poster is looking for (explained at various place by Professor Wooldridge say) is that if you start from

                            ivreg Y (X = Z1 Z2) W

                            and you want to consider the interaction of X and W, you go to

                            ivreg Y (X X*W = Z1 Z2 Z1*W Z2*W) W

                            whether this regression achieves this

                            Code:
                            ivreg2 emotional (i.currwork#i.husjob2=child3#husjob2 hheligwomen_w#husjob2 c.avgwork#husjob2) i.husjob2 i.ehypo i.ehyper dis i.educlvl i.decision attitude parentdv presentdv presentdva health i.wealthq i.union1more age i.agegapcat i.religion i.urban i.geo_eg1988_2014 ratio ratio1 i.year [pw=weight1]
                            has a question mark on it.
                            I was thinking the same thing when I saw the code in comment #5. Maybe I am making a syntax mistake, but as written in #5, my thoughts were that:
                            a) i.currwork#i.husjob2 captures only the interaction term involving the endogenous variable but not the stand-alone factor variable (i.e., using your example above, it included X*W but does not include X).
                            b) the instruments present are only for the interaction term, but not for X (since X is also not included as an endogenous variable (i.e., using your example above, it included Z1*W and Z2*W but does not include Z1 and Z2).

                            Wouldn't the correct syntax be the one below, so that both the level currwork and the interaction with husjob2 are specified as endogenous, and as a result 6 instruments instead of 3?

                            Code:
                            ivreg2 emotional (i.currwork i.currwork#i.husjob2 = i.child3 i.hheligwomen_w avgwork i.child3#i.husjob2 i.hheligwomen_w#i.husjob2 c.avgwork#i.husjob2) i.husjob2 i.ehypo i.ehyper dis i.educlvl i.decision attitude parentdv presentdv presentdva health i.wealthq i.union1more age i.agegapcat i.religion i.urban i.geo_eg1988_2014 ratio ratio1 i.year [pw=weight1]

                            Comment

                            Working...
                            X