Announcement

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

  • Endogenous Variable in Interaction, Simulatenous Equations, Use of IV

    Hi all,

    Background:

    I am dealing with the following demand equation :

    Sales = Price + Media + other exogenous variables

    Theoretically, Price and Media both are endogenous variables and are also dependent upon each other. In such a situation, I am trying to solve a simultaneous equations system:

    Sales = Price + Media + other exogenous variables

    Price = Media + lag_Sales + Z1 + other exogenous variables

    Media = Price + Media + lag_Sales + Z2 + other exogenous variables

    where Z1 & Z2 are instruments for price and media.

    I used reg3 command to solve the simultaneous equations and got results.

    Here is the Problem:

    Now the problem is advanced with the following demand equation:

    Sales = Price + Media + Price*Media+ Price*Media*cat1+ Price*Media*cat2 + i.cat* Price + other exogenous variables

    wherein there is an interaction between the endogenous variables, interaction of (price & media) with two indicator variables - cat1 & cat 2; finally, also there is an interaction af factor variables for cat1,cat2,cat3 interacted with the Price.

    Other two equations remain the same.

    Now, how do I deal with the endogeneity issue in these equations? How do I make sure that the interaction of endogenous variables is also corrected for endogeneity in a simultaneous equations system? Can I use reg3? If not, can someone advise a step by step procedure?

    Thank you!
    Guneet


  • #2
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float(y1 y2 x1 x2) int(x3 x4) byte x5
     89.1  99.6  96.7   101  12  28  1
     99.2 102.6  98.1 100.1  15  35  2
       99 125.6   100   100  17  37  3
      100 130.1 104.9  90.6  22  42  4
    111.6 135.6 104.9  86.5  36  47  5
    122.2 142.2 109.5  89.7  45  51  6
    117.6 157.6 110.8  90.6  66  56  7
    121.1 125.2 112.3  82.8  89  60  8
      136   136 109.3  70.1  99  65  9
    154.2 154.2 105.3  65.4 118  69 10
    153.6 153.6 101.7  61.3 134  74 11
    158.5 155.5  95.4  62.5 151  78 12
    140.6 140.7  96.4  63.6 167  83 13
    136.2 176.2  97.6  52.6 184  87 14
      168 185.8 102.4  59.7 200  92 15
    154.3 186.3 101.6  59.5 217  96 16
      149   189 103.8  61.3 233 101 17
    end
    
     fvunab Z: c.x3##c.x4##c.x5
     di "`Z'"
     fvunab XY: c.y2##c.x1##c.x2
     di "`XY'"
     local Y y2
     di "`Y'"
     local X: list XY - Y
     di "`X'"
    
     ivreg2 y1 `X' (`Y' = `Z')

    HTML Code:
    .  fvunab Z: c.x3##c.x4##c.x5
    .  di "`Z'"
    x3 x4 c.x3#c.x4 x5 c.x3#c.x5 c.x4#c.x5 c.x3#c.x4#c.x5
    .
    .  fvunab XY: c.y2##c.x1##c.x2
    .  di "`XY'"
    y2 x1 c.y2#c.x1 x2 c.y2#c.x2 c.x1#c.x2 c.y2#c.x1#c.x2
    
    .  local Y y2
    .  di "`Y'"
    y2.
    
    .  local X: list XY - Y
    .  di "`X'"
    x1 c.y2#c.x1 x2 c.y2#c.x2 c.x1#c.x2 c.y2#c.x1#c.x2
    
    .  ivreg2 y1 `X' (`Y' = `Z')
    
    IV (2SLS) estimation
    --------------------
    
    Estimates efficient for homoskedasticity only
    Statistics consistent for homoskedasticity only
    
                                                          Number of obs =       17
                                                          F(  7,     9) =     9.75
                                                          Prob > F      =   0.0014
    Total (centered) SS     =  9651.958509                Centered R2   =   0.8824
    Total (uncentered) SS   =  297003.9601                Uncentered R2 =   0.9962
    Residual SS             =  1135.353606                Root MSE      =    8.172
    
    ------------------------------------------------------------------------------
              y1 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
              y2 |   8.968341   22.04413     0.41   0.684    -34.23736    52.17404
              x1 |   20.51112   35.59004     0.58   0.564    -49.24408    90.26632
                 |
       c.y2#c.x1 |  -.0988948   .2215917    -0.45   0.655    -.5332067     .335417
                 |
              x2 |   23.23761   40.19759     0.58   0.563    -55.54822    102.0234
                 |
       c.y2#c.x2 |  -.1099902    .245903    -0.45   0.655    -.5919513    .3719708
                 |
       c.x1#c.x2 |  -.2647819   .4065415    -0.65   0.515    -1.061589    .5320248
                 |
       c.y2#c.x1#|
            c.x2 |    .001266   .0025016     0.51   0.613    -.0036372    .0061691
                 |
           _cons |  -1717.589   3558.498    -0.48   0.629    -8692.117     5256.94
    ------------------------------------------------------------------------------
    Underidentification test (Anderson canon. corr. LM statistic):          10.961
                                                       Chi-sq(7) P-val =    0.1403
    ------------------------------------------------------------------------------
    Weak identification test (Cragg-Donald Wald F statistic):                0.778
    Stock-Yogo weak ID test critical values:  5% maximal IV relative bias    19.86
                                             10% maximal IV relative bias    11.29
                                             20% maximal IV relative bias     6.73
                                             30% maximal IV relative bias     5.07
                                             10% maximal IV size             31.50
                                             15% maximal IV size             17.38
                                             20% maximal IV size             12.48
                                             25% maximal IV size              9.93
    Source: Stock-Yogo (2005).  Reproduced by permission.
    ------------------------------------------------------------------------------
    Sargan statistic (overidentification test of all instruments):           9.989
                                                       Chi-sq(6) P-val =    0.1251
    ------------------------------------------------------------------------------
    Instrumented:         y2
    Included instruments: x1 c.y2#c.x1 x2 c.y2#c.x2 c.x1#c.x2 c.y2#c.x1#c.x2
    Excluded instruments: x3 x4 c.x3#c.x4 x5 c.x3#c.x5 c.x4#c.x5 c.x3#c.x4#c.x5
    ------------------------------------------------------------------------------
    Emad A. Shehata
    Professor (PhD Economics)
    Agricultural Research Center - Agricultural Economics Research Institute - Egypt
    Email: emadstat@hotmail.com
    IDEAS: http://ideas.repec.org/f/psh494.html
    EconPapers: http://econpapers.repec.org/RAS/psh494.htm
    Google Scholar: http://scholar.google.com/citations?...r=cOXvc94AAAAJ

    Comment


    • #3
      Code:
      di e(cmdline)
      
      ivreg2 y1 x1 c.y2#c.x1 x2 c.y2#c.x2 c.x1#c.x2 c.y2#c.x1#c.x2 (y2 = x3 x4 c.x3#c.x4 x5 c.x3#c.x5 c.x4#c.x5 c.x3#c.x4#c.x5)
      Emad A. Shehata
      Professor (PhD Economics)
      Agricultural Research Center - Agricultural Economics Research Institute - Egypt
      Email: emadstat@hotmail.com
      IDEAS: http://ideas.repec.org/f/psh494.html
      EconPapers: http://econpapers.repec.org/RAS/psh494.htm
      Google Scholar: http://scholar.google.com/citations?...r=cOXvc94AAAAJ

      Comment


      • #4
        Thank you Emad.

        If I understand you answer correctly, are you just correcting for endogeneity of one of the endogenous variables (y2 it seems like- price) and not two (in my case - price & media)

        Also, since I am estimating the equations simultaneously (3 equations, not 1), I believe regular ivreg2 will not work. It can help us estimate just the key equation (equation 1 in my question above) and I still do know know the coefficients in equation 2 & 3.

        - Guneet

        Comment


        • #5
          The same idea
          local Y y2 y3
          And modify your local XY
          Emad A. Shehata
          Professor (PhD Economics)
          Agricultural Research Center - Agricultural Economics Research Institute - Egypt
          Email: emadstat@hotmail.com
          IDEAS: http://ideas.repec.org/f/psh494.html
          EconPapers: http://econpapers.repec.org/RAS/psh494.htm
          Google Scholar: http://scholar.google.com/citations?...r=cOXvc94AAAAJ

          Comment


          • #6
            fvunab XY: c.y2##c.x1##c.x2 c.y3##c.x1##c.x2
            Emad A. Shehata
            Professor (PhD Economics)
            Agricultural Research Center - Agricultural Economics Research Institute - Egypt
            Email: emadstat@hotmail.com
            IDEAS: http://ideas.repec.org/f/psh494.html
            EconPapers: http://econpapers.repec.org/RAS/psh494.htm
            Google Scholar: http://scholar.google.com/citations?...r=cOXvc94AAAAJ

            Comment


            • #7
              Dear Emad,
              • I am getting error - 'interactions not allowed'.
              • Secondly, I am still not sure how ivreg2 command takes care of the simultaneous relation between Sales, Price & Media, lagged_Sales. Can you please explain?
              Thanks!
              Guneet

              Comment


              • #8
                Guneet:
                as far as your first question is concerned (
                ...'interactions not allowed'...
                ), check whether -ivreg2- support the -xi- prefix.
                Kind regards,
                Carlo
                (Stata 16.0 SE)

                Comment


                • #9
                  Dear Carlo,

                  xi option allows for only interactions with the factor variables, e.g. i.cat_id | price. But it does not allow for two continuous variables ,i.e. price | media.

                  Thanks!

                  Comment


                  • #10
                    This example with 2 endogenous variables

                    Code:
                     clear all
                    input float(y1 y2 y3 x1 x2) int(x3 x4) byte x5
                     89.1  99.6  96.7  96.7   101  12  28  1
                     99.2 102.6  98.1  98.1 100.1  15  35  2
                       99 125.6   100   100   100  17  37  3
                      100 130.1 104.9 104.9  90.6  22  42  4
                    111.6 135.6 124.9 104.9  86.5  36  47  5
                    122.2 142.2 109.5 109.5  89.7  45  51  6
                    117.6 157.6 120.8 110.8  90.6  66  56  7
                    121.1 125.2 112.3 112.3  82.8  89  60  8
                      136   136 119.3 109.3  70.1  99  65  9
                    154.2 154.2 115.3 105.3  65.4 118  69 10
                    153.6 153.6 121.7 101.7  61.3 134  74 11
                    158.5 155.5 125.4  95.4  62.5 151  78 12
                    140.6 140.7 146.4  96.4  63.6 167  83 13
                    136.2 176.2 127.6  97.6  52.6 184  87 14
                      168 185.8 132.4 102.4  59.7 200  92 15
                    154.3 186.3 132.6 101.6  59.5 217  96 16
                      149   189 155.8 103.8  61.3 233 101 17
                    end
                    
                     local X x1
                     local Y y2 y3
                     fvunab Z: c.x3##c.x4##c.x5
                     fvunab XY: c.y2##c.x1 c.y3##c.x1
                     local X: list XY - X
                     local X: list X - Y
                    
                     ivreg2 y1 `X' (`Y' = `Z')

                    HTML Code:
                    .  ivreg2 y1 `X' (`Y' = `Z')
                    
                    IV (2SLS) estimation
                    --------------------
                    
                    Estimates efficient for homoskedasticity only
                    Statistics consistent for homoskedasticity only
                    
                                                                          Number of obs =       17
                                                                          F(  5,    11) =     5.58
                                                                          Prob > F      =   0.0084
                    Total (centered) SS     =  9651.958509                Centered R2   =   0.7132
                    Total (uncentered) SS   =  297003.9601                Uncentered R2 =   0.9907
                    Residual SS             =  2768.137795                Root MSE      =    12.76
                    
                    ------------------------------------------------------------------------------
                              y1 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
                    -------------+----------------------------------------------------------------
                              y2 |   3.547508   8.108174     0.44   0.662    -12.34422    19.43924
                              y3 |   5.222722    12.7112     0.41   0.681    -19.69078    30.13622
                              x1 |   9.459618   7.097883     1.33   0.183    -4.451976    23.37121
                                 |
                       c.y2#c.x1 |  -.0289516   .0806591    -0.36   0.720    -.1870406    .1291374
                                 |
                       c.y3#c.x1 |  -.0492394   .1266622    -0.39   0.697    -.2974927    .1990139
                                 |
                           _cons |  -945.6873   715.0449    -1.32   0.186     -2347.15    455.7749
                    ------------------------------------------------------------------------------
                    Underidentification test (Anderson canon. corr. LM statistic):           4.900
                                                                       Chi-sq(6) P-val =    0.5568
                    ------------------------------------------------------------------------------
                    Weak identification test (Cragg-Donald Wald F statistic):                0.347
                    Stock-Yogo weak ID test critical values:  5% maximal IV relative bias    16.88
                                                             10% maximal IV relative bias     9.92
                                                             20% maximal IV relative bias     6.16
                                                             30% maximal IV relative bias     4.76
                                                             10% maximal IV size             23.72
                                                             15% maximal IV size             13.34
                                                             20% maximal IV size              9.77
                                                             25% maximal IV size              7.91
                    Source: Stock-Yogo (2005).  Reproduced by permission.
                    ------------------------------------------------------------------------------
                    Sargan statistic (overidentification test of all instruments):          12.392
                                                                       Chi-sq(5) P-val =    0.0298
                    ------------------------------------------------------------------------------
                    Instrumented:         y2 y3
                    Included instruments: x1 c.y2#c.x1 c.y3#c.x1
                    Excluded instruments: x3 x4 c.x3#c.x4 x5 c.x3#c.x5 c.x4#c.x5 c.x3#c.x4#c.x5
                    ------------------------------------------------------------------------------
                    Emad A. Shehata
                    Professor (PhD Economics)
                    Agricultural Research Center - Agricultural Economics Research Institute - Egypt
                    Email: emadstat@hotmail.com
                    IDEAS: http://ideas.repec.org/f/psh494.html
                    EconPapers: http://econpapers.repec.org/RAS/psh494.htm
                    Google Scholar: http://scholar.google.com/citations?...r=cOXvc94AAAAJ

                    Comment


                    • #11
                      Dear Emad,

                      Thank you so much for putting effort in writing the response.I really appreciate it. I have the following questions:
                      1. I also want to allow for a term which is the interaction between two endogenous variables, i.e, the term y2*y3. So, how will the ivreg2 equation change? I want a coefficient in the result table for y2*y3.
                      2. Also, since the interaction terms c.y2#c.x1 and c.y3#c.x1 are the included instruments, STATA will treat them as exogenous. However, that is not the case since the interaction terms c.y2#c.x1 and c.y3#c.x1 have y2 & y3 variables, which are endogenous.
                      Thanks!
                      Guneet

                      Comment


                      • #12
                        Interactions among endogenous variables have no economic meaning
                        endogenous variables are treated as dependent variables in the first stage of 2SLS
                        Emad A. Shehata
                        Professor (PhD Economics)
                        Agricultural Research Center - Agricultural Economics Research Institute - Egypt
                        Email: emadstat@hotmail.com
                        IDEAS: http://ideas.repec.org/f/psh494.html
                        EconPapers: http://econpapers.repec.org/RAS/psh494.htm
                        Google Scholar: http://scholar.google.com/citations?...r=cOXvc94AAAAJ

                        Comment


                        • #13
                          In your model you have 2 endogenous variables
                          Y2 and Y3
                          If you make interactions
                          Y4= y2*y3
                          Then any software will deal with Y4 as a third endogenous variable
                          Emad A. Shehata
                          Professor (PhD Economics)
                          Agricultural Research Center - Agricultural Economics Research Institute - Egypt
                          Email: emadstat@hotmail.com
                          IDEAS: http://ideas.repec.org/f/psh494.html
                          EconPapers: http://econpapers.repec.org/RAS/psh494.htm
                          Google Scholar: http://scholar.google.com/citations?...r=cOXvc94AAAAJ

                          Comment


                          • #14
                            In fact Stata made an ingenous way to prevent interactions among endogenous variables to avoid misspecificaion problem.
                            Best regards
                            Emad A. Shehata
                            Professor (PhD Economics)
                            Agricultural Research Center - Agricultural Economics Research Institute - Egypt
                            Email: emadstat@hotmail.com
                            IDEAS: http://ideas.repec.org/f/psh494.html
                            EconPapers: http://econpapers.repec.org/RAS/psh494.htm
                            Google Scholar: http://scholar.google.com/citations?...r=cOXvc94AAAAJ

                            Comment


                            • #15
                              Thank you Emad.

                              Comment

                              Working...
                              X