Announcement

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

  • Interaction in IV regression

    Hello everyone,
    I am running a 2SLS: Y=Xβ+Covariatesδ+ϵ. Here, X is endogenous. So, the first stage is X= Zγ+ω. Now, I want to see whether the effect of X varies for a categorical variable, say firm size (size=1 if large firm; 0 otherwise). Now in stata17 I am using the following command-
    Code:
    ivreg2 Y covariate1 covariate2 (c.X#i.size = Z1 Z2 Z1#i.size Z2#i.size)
    I have purposefully excluded c.X in left hand side in first stage so that I get the coefficients of X for two different firm sizes in one regression. The issue that I am facing is that, when I run this same regression, the coefficients do not match with this following approach-
    Code:
    Ivreg2 Y covaraite1 covaraite2 (X= Z1 Z2) if size==0
    and
    Code:
    Ivreg2 Y covaraite1 covaraite2 (X= Z1 Z2) if size==1
    I know that this last approach will affect the standard errors because of power. But what I do not understand is why are the coefficients of X differing in these two approaches?

    Regards,
    Ashik
    Last edited by Ashik Sufi Islam; 07 Sep 2023, 12:59.

  • #2
    the samples are different.

    Comment


    • #3
      Don’t think you need interaction in IV part. The X will give you different value for the regressive.

      Comment


      • #4
        Thank you so much for your feedback on this. I think I haven't stated my problem clearly. Let me rephrase it-

        I need to know the effect of X on Y for size 1 & 0. Since X is endogenous, I follow two approaches. (1) using the interaction term in ivreg2; (2) split the sample by size and then run the regression without the interaction separately for each size category using ivreg2. Now, my understanding is that, these two approaches should yield same coeff. But, since in approach (2) I split the sample, the standard error in this approach is going to be different than that of approach (1).

        But when I follow these approaches in stata, I get different coefficients along with standard errors. In particular, the results are-
        For approach (1): 0b.size #c.Y 0.0272***; 1.size #c.Y 0.0259***

        For approach (2): c.Y 0.0298*** when size==0
        c.Y 0.0031 when size==1
        As you can see in approach (1) the effect of X on Y is significant for both small and large firms. But in approach (2) there is no significant effect of X on Y for large firms. Also, the coeffe. changes from 0.0259*** to 0.0031. Why is the effect different in these two approaches when both of these should yield same coeff. What am I doing wrong here?
        Last edited by Ashik Sufi Islam; 08 Sep 2023, 03:16.

        Comment


        • #5
          I don't think they should produce the same coefficients or t-statistics. First, the coefficients on covariate1 and covariate2 will differ in the split samples. Second, the constants will differ. Third, the sample sizes differ.

          Try this:

          Code:
           ivreg2 Y i.size#(c.covariate1 c.covariate2) i.size (c.X#i.size = i.size#(c.Z1 c.Z2))
          this should get you equal coefficients and similar t-stats.

          the question is how do you feel about imposing equal coefficients across the size groups. you could get very different results.
          Last edited by George Ford; 08 Sep 2023, 09:00.

          Comment


          • #6
            Code:
            sysuse auto, clear
            
            eststo e1: ivreg2 price headroom turn foreign  (c.mpg#i.foreign = i.foreign#(c.weight c.length))
            eststo e2: ivreg2 price i.foreign#(c.headroom c.turn) foreign  (c.mpg#i.foreign = i.foreign#(c.weight c.length))
            eststo e3: ivreg2 price headroom turn (mpg = weight length) if ~foreign
            eststo e4: ivreg2 price headroom turn (mpg = weight length) if foreign
            esttab e1 e2 e3 e4
            Click image for larger version

Name:	subpop002.jpg
Views:	1
Size:	33.0 KB
ID:	1726469

            Comment


            • #7
              Using the control function

              Code:
              eststo c1: reg mpg i.foreign#(c.weight c.length c.headroom c.turn) foreign
              capture drop cf
              predict cf , residuals
              eststo c2: reg price headroom turn i.foreign#(c.mpg c.cf) foreign , vce(bootstrap, reps(100))
              eststo c3: reg price headroom turn c.mpg#i.foreign cf foreign , vce(bootstrap, reps(100))
              eststo c4: reg price i.foreign#(c.headroom c.turn c.mpg c.cf) foreign , vce(bootstrap, reps(100))
              eststo c5: reg price headroom turn mpg cf if ~foreign , vce(bootstrap, reps(100))
              eststo c6: reg price headroom turn mpg cf if foreign , vce(bootstrap, reps(100))
              get same coefficients in 3-4 as above.
              Click image for larger version

Name:	subpop004.jpg
Views:	1
Size:	46.1 KB
ID:	1726472

              Comment


              • #8
                Imposing the same coefficients in the first stage. quite different.

                Code:
                eststo t1: reg mpg weight length headroom turn foreign
                capture drop cf
                predict cf , residuals
                eststo t2: reg price headroom turn i.foreign#(c.mpg c.cf) foreign , vce(bootstrap, reps(100))
                eststo t3: reg price headroom turn c.mpg#i.foreign cf foreign , vce(bootstrap, reps(100))
                eststo t4: reg price i.foreign#(c.headroom c.turn c.mpg c.cf) foreign , vce(bootstrap, reps(100))
                eststo t5: reg price headroom turn mpg cf if ~foreign , vce(bootstrap, reps(100))
                eststo t6: reg price headroom turn mpg cf if foreign , vce(bootstrap, reps(100))
                Click image for larger version

Name:	subpop005.jpg
Views:	1
Size:	50.3 KB
ID:	1726475

                Comment


                • #9
                  Thank you for the clarification, George Ford. I just want to reconfirm what I understood.
                  Since, I want to see the effect of X on Y for different size groups in the same regression, I should use a model that allows X to differ across different size groups along with the covariates as well.
                  Code:
                  ivreg2 Y i.size#(c.covariate1 c.covariate2) i.size (c.X#i.size = i.size#(c.Z1 c.Z2))
                  Imposing the coefficients of the covariates to be same for the two size groups, as I was doing previously, may not be the appropriate approach for this kind of questions. Have I got this part right?

                  Comment


                  • #10
                    #9 should get you the same coefficients as estimating the two separately.

                    as for the best approach, I can't answer that knowing what I know about the problem.

                    is it better to assume equal coefficients except for mpg?
                    is there some reason to believe they others would be the same?
                    since you think mpg is different, why not the others?

                    Most work I've read assumes equal coefficients across groups, but permits differences in some coefficients, or perhaps all of them (Oaxaca style).

                    You can test for differences in the coefficients across groups.

                    I'd probably start with something like t1 above to get the control function, then run the model fully interactive in size, and test for equal coefficients for all the covariates or some subset of them.

                    Of course, you'll want to test for the difference in X, since that is what you're most interested in.

                    Code:
                    reg mpg weight length headroom turn foreign
                    capture drop cf
                    predict cf , residuals
                    reg price headroom turn mpg cf c.foreign#(c.headroom c.turn c.mpg c.cf) foreign , vce(bootstrap, reps(100))
                    testparm c.foreign#(c.headroom c.turn c.mpg c.cf)
                    Click image for larger version

Name:	subpop007.jpg
Views:	1
Size:	217.9 KB
ID:	1726569

                    Comment


                    • #11
                      Thank you for your elaborated explanation!

                      Comment

                      Working...
                      X