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

From |
Rodolphe Desbordes <rodolphe.desbordes@strath.ac.uk> |

To |
"statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |

Subject |
RE: st: Cluster-robust estimate of the VCE, GMM, Mata |

Date |
Mon, 3 Aug 2009 10:11:46 +0100 |

Dear Stas, Many thanks for your answer. I will upgrade to Stata 11 but I would have liked to be able to do it "by hand". My hunch is that an easier solution would be to directly calculate the cluster-robust equivalent of Shat, i.e. replace >> Shat = ((y-mu):*Z)'((y-mu):*Z)*rows(X)/(rows(X)-cols(X)) in the original Cameron and Trivedi's example by something like >> V = J(cols(Z), cols(Z), 0) >> for(i=1; i<=colmax(C[.,1]); i++) { >> st_subview(x_j=., select(X, C:==i), ., .) >> st_subview(z_j=., select(Z, C:==i), ., .) >> st_subview(y_j=., select(y, C:==i), ., .) >> V = V +(cross(cross(z_j, (y_j- exp(x_j*b')))', cross(z_j, (y_j- exp(x_j* b')))')) >> } >> >> >> Shat = V*(rows(X))/(rows(X)-cols(X))*(colmax(C[.,1])/(colmax(C[.,1])-1)) However, I certainly made a mistake since I do not obtain the same results as those provided by the -poisson ,cl()- command. Any ideas? Best regards, Rodolphe ________________________________________ From: owner-statalist@hsphsun2.harvard.edu [owner-statalist@hsphsun2.harvard.edu] On Behalf Of Stas Kolenikov [skolenik@gmail.com] Sent: 03 August 2009 04:28 To: statalist@hsphsun2.harvard.edu Subject: Re: st: Cluster-robust estimate of the VCE, GMM, Mata Of course I don't know in details of what's going on. The fact that Mata could not compute the sandwich estimator is troublesome, to say the least. If anything, this is probably due to bad Hessian -- pull that out, see what it looks like. You need it as the "bread" part of the sandwich, anyway, so when you return to Stata, you need to -ereturn post- it (for later handling by -_robust-). You also need to figure out the dimensions of the score matrix -- looks like your `score_vars' local is empty, but you need to feel it with as many variables as you have parameters to be estimated. As I replied privately, if you have the funds, you should upgrade to Stata 11 and run the official -gmm-. David Drukker gave an example of Poisson regression in his talk last week, and I am pretty sure it is out there in the manual, too. On Fri, Jul 24, 2009 at 4:52 AM, Rodolphe Desbordes<rodolphe.desbordes@strath.ac.uk> wrote: > Dear Stas, > > I apologise for my late answer. I have tried your solution and I have encountered two difficulties. > > The first problem was the incompatibility of -optimize_result_V_robust()- with an evaluator of type d. I replaced - optimize_init_evaluatortype(S, "d2")- by -optimize_init_evaluatortype(S, "v2"). The initial do file still worked fine after this modification. > > The second problem is the output after inserting the code that you suggested: > -- Stas Kolenikov, also found at http://stas.kolenikov.name Small print: I use this email account for mailing lists only. * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/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/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**References**:**Re: st: Cluster-robust estimate of the VCE, GMM, Mata***From:*Stas Kolenikov <skolenik@gmail.com>

- Prev by Date:
**RE: st: Cluster-robust estimate of the VCE, GMM, Mata** - Next by Date:
**AW: st: logit with interaction and transformation** - Previous by thread:
**RE: st: Cluster-robust estimate of the VCE, GMM, Mata** - Next by thread:
**st: Analysis of pilot drug RCT with small samples and continuous DVs** - Index(es):

© Copyright 1996–2017 StataCorp LLC | Terms of use | Privacy | Contact us | What's new | Site index |