Announcement

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

  • Replicate OLS estimation using GMM command

    Hi Statalisters,

    I have a question about using the -gmm- command to replicate OLS estimation. Things work fine up until I introduce a dummy variable, and I have no idea why that would be troublesome. Consider the following example:

    Code:
    sysuse auto
    local rhs turn length headroom trunk
    reg mpg `rhs', r
    gmm (mpg -({xb:`rhs'}+{b0})), instruments(`rhs') winitial(identity) vce(robust) iterate(5)
    The two commands give identical point estimates, but slightly different SEs (but that's to be expected). Now I add a dummy variable (and post output rather than source code):

    Code:
    . local rhs turn length headroom trunk foreign
    . reg mpg `rhs', r
    
    Linear regression                               Number of obs     =         74
                                                    F(5, 68)          =      32.94
                                                    Prob > F          =     0.0000
                                                    R-squared         =     0.6473
                                                    Root MSE          =     3.5602
    
    ------------------------------------------------------------------------------
                 |               Robust
             mpg |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
            turn |  -.2573714   .1737776    -1.48   0.143    -.6041391    .0893963
          length |  -.1812296   .0578863    -3.13   0.003    -.2967399   -.0657193
        headroom |  -.0759515   .4046498    -0.19   0.852    -.8834176    .7315147
           trunk |    .004777   .1751617     0.03   0.978    -.3447527    .3543068
         foreign |  -1.632016   1.264629    -1.29   0.201    -4.155544    .8915119
           _cons |   66.20747   4.938808    13.41   0.000     56.35223     76.0627
    ------------------------------------------------------------------------------
    
    
    . gmm (mpg -({xb:`rhs'}+{b0})), instruments(`rhs') winitial(identity) vce(robust) iterate(5)
    
    Step 1
    Iteration 0:   GMM criterion Q(b) =   15985229  (not concave)
    Iteration 1:   GMM criterion Q(b) =    1253436  (not concave)
    Iteration 2:   GMM criterion Q(b) =  98463.417  (not concave)
    Iteration 3:   GMM criterion Q(b) =  7913.7578  (not concave)
    Iteration 4:   GMM criterion Q(b) =  817.35425  (not concave)
    Iteration 5:   GMM criterion Q(b) =  162.62732  (not concave)
    convergence not achieved
    
    note: model is exactly identified
    
    GMM estimation
    
    Number of parameters =   6
    Number of moments    =   6
    Initial weight matrix: Identity                   Number of obs   =         74
    GMM weight matrix:     Robust
    
    ------------------------------------------------------------------------------
                 |               Robust
                 |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
    -------------+----------------------------------------------------------------
            turn |   .0861536   .3691139     0.23   0.815    -.6372964    .8096036
          length |   .0181301   .0977029     0.19   0.853    -.1733641    .2096244
        headroom |   1.134376   1.059623     1.07   0.284    -.9424463    3.211198
           trunk |   .2445109   .3016458     0.81   0.418     -.346704    .8357258
         foreign |   12.96847   3.387061     3.83   0.000     6.329955    19.60699
    -------------+----------------------------------------------------------------
             /b0 |    3.45462   15.98317     0.22   0.829    -27.87182    34.78106
    ------------------------------------------------------------------------------
    Instruments for equation 1: turn length headroom trunk foreign _cons
    Warning: convergence not achieved
    Does anyone have any idea what might be going on here?

  • #2
    Apparently, the weighting matrix winitial(identity) leads to convergence problems. When you use the default weighting matrix, everything works fine.
    https://twitter.com/Kripfganz

    Comment


    • #3
      Thank you Sebastian!

      Comment

      Working...
      X