Announcement

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

  • nlcom after two GMMs, suest not working

    Hello,

    I need a nonlinear combinations of parameter estimates from two GMM models, call them model1 and GMM2.
    I do the following:

    gmm ($eq1-var1) ($eq2 - var2), winitial(identity) from(a 0.5 b 0.5)
    estimates store model1
    gmm ($eq3-var3) ($eq4 - var4) ($eq5 - var5) ($q6-var6), winitial(identity) from(c 0.5 d 0.5 e 0.5 f 0.5)
    estimates store model2
    suest model1 model2, vce(cluster clustervar)


    at which point I get a message:
    model1 was estimated with a nonstandard vce (robust)
    r(322);


    After suest, I would want the following:
    nlcom (comb: [model1]_b[/a]/ [model2]_b[/d] )

    I tried GMM's with various vce types, including "unadjusted", Stata always gives me the same error message, with the change that instead of vce (robust) it tells me whichever vce I used (e.g. vce (unadjusted)).

    I also tried retrieving estimates without suest but it does not work.

    Please let me know how can I do the above without Mata. I am very rusty in Mata and would strongly prefer to use the usual Stata language.

    Many thanks,
    Best wishes,
    Nona

  • #2
    This error message is not as specific as it could be; suest does not
    work with gmm estimation results.

    Nona could actually combine the two gmm model specifications into
    a single call to gmm and then use nlcom.

    Here is an example using the auto data that shows the point estimates
    in the combined model are the same as the separate gmm fits.

    Code:
    sysuse auto
    
    gmm     (mpg - {xb:gear_ratio turn} - {b0})                             ///
            ,                                                               ///
            instruments(gear_ratio turn)                                    ///
            winit(identity)                                                 ///
            derivative(/xb = -1)                                            ///
            derivative(/b0 = -1)                                            ///
            vce(unadjusted)
    estimates store mpg
    
    gmm     (price - {zb:headroom displacement foreign} - {a0})             ///
            ,                                                               ///
            instruments(headroom displacement foreign)                      ///
            winit(identity)                                                 ///
            derivative(/zb = -1)                                            ///
            derivative(/a0 = -1)                                            ///
            vce(unadjusted) 
    estimates store price
    
    gmm     (mpg:mpg - {xb:gear_ratio turn} - {b0})                         ///
            (price:price - {zb:headroom displacement foreign} - {a0})       ///
            ,                                                               ///
            instruments(mpg:gear_ratio turn)                                ///
            instruments(price:headroom displacement foreign)                ///
            winit(identity)                                                 ///
            derivative(mpg/xb = -1)                                         ///
            derivative(mpg/b0 = -1)                                         ///
            derivative(price/zb = -1)                                       ///
            derivative(price/a0 = -1)
    
    estimates table mpg price ., b se
    Here is the output I got from estimates table:

    Code:
    -----------------------------------------------------
        Variable |    mpg         price        active    
    -------------+---------------------------------------
    xb_gear_ra~o |
           _cons |  3.0328836                 3.0328836  
                 |  1.3448594                 1.5016643  
    -------------+---------------------------------------
    xb_turn      |
           _cons | -.73305019                -.73305019  
                 |  .13948458                   .117972  
    -------------+---------------------------------------
    b0           |
           _cons |  41.218012                 41.218012  
                 |  8.8065809                 8.3967394  
    -------------+---------------------------------------
    zb_headroom  |
           _cons |              -534.78093   -534.78093  
                 |               337.54132    271.96603  
    -------------+---------------------------------------
    zb_displac~t |
           _cons |               29.368237    29.368237  
                 |               3.7645843    4.2083208  
    -------------+---------------------------------------
    zb_foreign   |
           _cons |               3620.5118    3620.5118  
                 |               691.86449    658.46219  
    -------------+---------------------------------------
    a0           |
           _cons |               895.34402    895.34402  
                 |               1125.1362    897.25673  
    -----------------------------------------------------
                                             legend: b/se

    Comment


    • #3
      Jeff, this is a great idea! Thanks you!

      I did try doing that before posting my question here, but the problem I encounter there is that parameters a and b in my post do not get standard errors. I really have no explanation of why that happens. Because they do not come with standard errors, nlcom thinks they are just numbers so the standard error on the combination comes up too low.

      To be more specific, here is my combined gmm (where my parameter a in the previous post corresponds to wn, and b corresponds to gn, the equations are defined as the corresponding globals):

      global inaive "{wn}"
      global snaive "{wn}*{gn}"
      ...
      gmm ($nmeanx-x) ($nxx-x*x) ($meansstar-infpayn) ($meaninteractions - interactions) ($inaive - interactionsnaive) ($snaive-infpaynnaive), winitial(identity) vce(cluster strata) from(g 0.5 q 0.5 r 0.5 w 0.5 wn 0.5 gn 0.5)


      and this is what I get:

      Number of parameters = 6
      Number of moments = 6
      Initial weight matrix: Identity Number of obs = 780
      GMM weight matrix: Cluster (strata)

      (Std. Err. adjusted for 103 clusters in strata)

      Robust
      Coef. Std. Err. z P>z [95% Conf. Interval]

      /g .0868321 .0182984 4.75 0.000 .0509679 .1226962
      /r .5134686 .0445523 11.53 0.000 .4261476 .6007896
      /q .7561935 .0329366 22.96 0.000 .6916389 .8207481
      /w .9137773 .053899 16.95 0.000 .8081371 1.019417
      /wn .5589744 . . . . .
      /gn .0733945 . . . . .


      the estimates of wn and gn are "correct" in the sense that when I run those two as a separate gmm it gives me the exact same estimates, BUT I do get standard errors, unlike in the above.

      Any ideas of what is going on and how to fix it?

      Thanks a lot!
      Best wishes,
      Nona
      Last edited by Nona Karalashvili; 12 Aug 2014, 19:48.

      Comment


      • #4
        Maybe if you gave us the full specification of your gmm model and a dataset that reproduces
        this behavior, one of us might have some further insight.

        Comment


        • #5
          I will ask my co-authors.

          Thanks again!
          Nona

          Comment


          • #6
            Please see the data attached.
            Here is the gmm model.

            scalar nnn = 7
            local phi = 1
            local psi = 0
            global inaive "{wn}"
            global snaive "{wn}*{gn}"
            global meaninteractions "{w}*((1-{r}*{q}))^(`phi')+({w}*{r}*(1-{g})*{q})*(`psi')"
            global nmeanx "(nnn/2)*(1+{g})*(1-{r}*{q})"
            global nxx "(nnn/2)*(1+{g})*(1-{r}*{q})+(nnn-1)*nnn*(1/2*(1+{g}))^2*(1-2*{r}*{q}+{r}*{q}^2)"
            global meansstar "{w}*{g}*(1-{r}*{q}-`phi'*{r}*{q}*(1-{q}))"

            gmm ($nmeanx-x) ($nxx-x*x) ($meansstar-infpayn) ($meaninteractions - interactions) ($inaive - interactions) ($snaive-infpayn), winitial(identity) vce(cluster strata) from(g 0.5 q 0.5 r 0.5 w 0.5 wn 0.5 gn 0.5)
            nlcom (behav: (_b[/wn])/ (_b[/w]) * 1 / (1-(_b[/r])*(_b[/q]) -`phi'*(_b[/r])*(_b[/q])*(1-(_b[/q])) ) ) (goverg: (_b[/g])/ (_b[/gn]) )


            As you will see, {wn} and {gn} come out without standard errors, which is why nlcom's output is incorrect (see goverg's standard error in comparison with g's)

            Any insight on how to fix the problem would be much appreciated. The alternative is to simply bootstrap the linear combination's standard errors, but I would rather use a more conventional route.

            Thanks again!
            Best wishes,
            Nona
            Attached Files

            Comment


            • #7
              It looks like the last two moment equations for the variables
              interactions and infpayn are in conflict with moment
              equations 3 and 4, also for variables interaction and infpayn.

              Comment


              • #8
                I do have the same sense, but I fail to see any reason.
                At the same time, if I copy those variables and name differently, so that I have two sets of variables which are copies of each other (so that there is no conflict due to sharing of variables), this does not solve the problem either. It could be that this perfect correlation is the reason, but I fail to see the underlying logic.

                Thanks again!
                Nona

                Comment


                • #9
                  So, here is what helped. I created a new dummy with exact same number of 1 as interactions but with different order, and I used that instead of interactions in the fifth moment condition. I got the standard errors for wn this way.. So it was the use of the same, or perfectly correlated variables that made Stata stumble. Though there is no theoretical problem with the model.
                  Thanks again! Your input really helped me get to the bottom of this! I really appreciate your time!

                  Nona

                  Comment


                  • #10
                    well, the problem with my solution however is that I can no longer estimate clusterred standard errors because of that re-ordering that was necessary to kill off the perfect correlation. This is a real problem. I guess the only thing I can do is to bootrstap and get the standard error of that combination of estimates that I need. Please let me know if there are other solutions.

                    Thanks again!
                    Nona

                    Comment


                    • #11
                      Hi there,

                      I am getting the same error message when using suest. I'm trying to compare coefficients between two models with high dimensional fixed effects. Here is what I am trying to run.

                      reghdfe y x, absorb(fe1 fe2 fe3)
                      est store eq1
                      reghdfe y x z, absorb(fe1 fe2 fe3)
                      est store eq2

                      suest eq1 eq2, vce(cl cluster1)

                      This is where I'm getting the error about nonstandard vce. Is there anyway to get around this problem and estimate a SUR when using these high dimensional fixed effects.

                      Thanks!

                      Mike

                      Comment


                      • #12
                        Hi Michael,

                        So far I see a few reasons for why this will not work
                        • suest doesn't support -areg- and since -reghdfe- (SSC) is basically -areg- on steroids, this hints that they are not compatible. Delving further into this, the problem is that in areg and reghdfe you don't get the residuals with "e = y - xb", but you need the additional fixed effects (i.e. "e = y-xb-d" in stata notation)
                        • The second problem, and the one -suest- complained about, is that reghdfe uses e(vce)="unadjusted" instead of the usual e(vce)="ols" for the default case (even though they are the same thing). I don't remember well the reason behind that, but I think that "unadjusted" is more general than just "ols" (e.g. in the iv case).
                        Finally, I'm not entirely sure of the reasons for using -suest- in this case. I'm not familiar with the command though so I might be missing something.

                        Best,
                        Sergio

                        Comment


                        • #13
                          Hi Sergio,

                          Thanks for the response. Mainly, I want to test for significant differences between coefficients in a full model and a nested model. The only way I know how to do this is with a seemingly unrelated equations framework. The full and nested models I want to use are estimated with reghdfe (I actually cluster my SE's but the suest command told me to cluster with suest).

                          I'm not sure if that clears up what I'm trying to do, but in any case, it seems like I won't be able to use suest for this task. If you have any suggestions on the SUR methodology with reghdfe, please let me know.

                          Thanks,
                          Mike

                          Comment


                          • #14
                            Ok, I think I found your solution. You can run the -test varlist- command after reghdfe, with varlist being equal to the additional variables in the full model.
                            Now, do not run this after a regression with unadjusted/ols errors, as the results of -test- will be wrong. They seem to work fine with clustered errors, as shown in the proof of concept below:

                            Best,
                            Sergio

                            Code:
                            cls
                            clear all
                            sysuse auto
                            gen n = _n
                            local vce cluster n 
                            
                            reghdfe price length weight displacement, absorb(turn) vce(cluster n )
                            di e(df_r)
                            di e(df_a)
                            di e(df_m)
                            test length weight
                            
                            areg price length weight displacement, absorb(turn) vce(cluster n)
                            di e(df_r)
                            di e(df_a)
                            di e(df_m)
                            test length weight
                            
                            qui regress price length weight displacement i.turn, vce(cluster n)
                            test length weight

                            Comment


                            • #15
                              Hi Sergio,

                              I really appreciate the help, but I don't see how I can test coefficients across two different models. For example, with your code example from above, I would want to do something like the following. Let me know if that doesn't make sense. I know suest does this for reg commands (as well as probit, logit, etc).

                              Thanks again,
                              Mike

                              cls
                              clear all
                              sysuse auto
                              gen n = _n
                              local vce cluster n

                              reghdfe price length, absorb(turn) vce(cluster n) // This is model1
                              reghdfe price length weight displacement, absorb(turn) vce(cluster n) // This is model2

                              test length(model1) = length(model2)
                              Last edited by Michael Wittry; 27 Feb 2015, 16:44.

                              Comment

                              Working...
                              X