Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Recovering Jacobian from gmm estimate


From   Tony Ditta <tony.stata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Recovering Jacobian from gmm estimate
Date   Fri, 4 Oct 2013 13:50:10 -0500

Thanks! Is this a Stata 13 thing? I should mention that I'm on Stata
12. When I run your code on Stata 12, the e(G) matrix is empty (though
the e(W) matrix works as expected):

. sysuse auto
. gmm (mpg - {b0} - {b1}*gear), inst(gear turn head) onestep vce(unadj)
. mat G = e(G)
. mat W = e(W)
. matrix list G

symmetric G[1,1]
    c1
r1   .

. matrix list W

symmetric W[4,4]
                       1:          1:          1:          1:
              gear_ratio        turn    headroom       _cons
1:gear_ratio   .44634078
      1:turn   .02913199   .00502039
  1:headroom    .0266585  -.00514461   .08593673
     1:_cons  -2.5804966  -.27148176  -.13362431   18.992525

On Fri, Oct 4, 2013 at 1:30 PM, Brian P. Poi <bpoi@stata.com> wrote:
> On 10/04/2013 10:52 AM, Tony Stata wrote:
>>
>> Hello everyone,
>>
>> To calculate the asymptotic variance of the gmm estimate, Stata
>> numerically calculates the Jacobian matrix (unless the analytic
>> derivatives are supplied manually). What is the best way to recover
>> this matrix and store it locally?
>>
>> A few comments:
>>
>> (i) For reference, I'm referring to the G_bar(Beta_hat) matrix in
>> equation 5 in the gmm section of the Stata Reference Manual (Release
>> 12)
>>
>> (ii) It would be possible to numerically calculate the Jacobian after
>> estimation, but that could be computationally costly, and Stata has
>> already done that computation, so it would be nice to avoid that
>> redundancy
>>
>> (iii) From what I can tell, all the other matrices in the asymptotic
>> variance calculation are being saved in e() by gmm: e(W) is the weight
>> matrix, e(S) is the moment var-cov matrix, and e(V) is the parameter
>> var-cov matrix, but I can't find the Jacobian
>>
>> Thanks!
>
>
> Tony,
>
> Although not documented, you can get the final G matrix in the saved
> results.  It is stored as e(G).  Note that this matrix does not have the row
> and column names set.  We'll get this added to the documentation in a future
> update.
>
> Here's a silly example:
>
>    . sysuse auto
>    . gmm (mpg - {b0} - {b1}*gear), inst(gear turn head) onestep vce(unadj)
>    . mat G = e(G)
>    . mat W = e(W)
>    . mat V = invsym(G'*W*G) / 74     /* N = 74 observations */
>    . di sqrt(V[1,1])
>    3.5392953
>    . di sqrt(V[2,2])
>    1.1609056
>
>
>    -- Brian Poi
>    -- bpoi@stata.com
>
>
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/statalist-faq/
> *   http://www.ats.ucla.edu/stat/stata/
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index