# Re: st: clustered SE for reg3

 From Stas Kolenikov To statalist@hsphsun2.harvard.edu Subject Re: st: clustered SE for reg3 Date Tue, 24 Feb 2009 08:49:38 -0600

As far as I understand the internal mechanics of the sandwich
estimation in Stata (although I cannot say I have figured out all ins
and outs), -_robust- relies on scores supplied by -predict, score-.
The inner product of these is the meat of the sandwich. The score
terminology comes from maximum likelihood: scores are the first
derivatives of the objective function, which is the log-likelihood.
Generally scores are just estimating equations. Think about normal
equations for linear regression as an example. For instrumental
variable estimators, an estimating equation is the moment condition
(orthogonality) that has the form \sum_i [instrument_ij times
residual_ik], may be with some scaling in front of it that does not
really matter. The indices are running through the list of instruments
(j) and through the list of equations (k). That's my superficial
understanding of what's going on. May be in three-stage estimation
something will be different -- in particular, you compound your
estimating equations using the covariance matrix of residuals, and
that sure should appear somewhere.

On 2/22/09, Vera Troeger <vtroe@essex.ac.uk> wrote:
>
>  what do you mean by the scores are just the residuals times instruments?
> can you clarify?
>  do you know how to compute scores for reg3?
>  many thanks.
>  V.
>
>  Stas Kolenikov schrieb:
>
>
> > Given the heavily matrix-oriented character of the problem, you might
> > want to program it up in Mata if you have the formulas handy. Of
> > course -mataccum- does wonders at times -- James Hardin's explanation
> > of Murphy-Topel standard errors using straight Stata was wonderful.
> >
> > For what I understand, the scores should be products of residuals
> > times instruments. May be you can produce these and inject them into
> > -_robust-.
> >
> > As with many "obviously good" extensions not available in Stata, you
> > would need to ask yourself a question, "Are there any conceptual
> > limitations to this technique? May be there is something odd about it,
> > so Stata folks have given it a thought and decided it would not be
> > appropriate to code it since the results are going to be misleading".
> > That's what the issue is with many "obvious" things that turn out to
> > be straight wrong. I don't see why -cluster- option should be wrong
> > for -reg3- though.
> >
> > May be you can fool -ivreg2- or -xtivreg2- into your data structure? I
> > am just thinking aloud here.
> >
> > On 2/13/09, Vera Troeger <vtroe@essex.ac.uk> wrote:
> >
> >
> > >  I am trying to program clustered SE for a 3 stage LS simultaneous
> equation
> > > model: reg3.
> > >  reg3 dosn't offer a robust cluster option, so I tried to use the
> _robust
> > > programmers routine.
> > >  it all works fine, except  that  apparently as with reg (simple OLS)
> one
> > > has to force the RMSE to be 1 before using the _robust option. Now reg3
> > > doesn't have an mse1 option either as reg does...
> > >  I found that in a single equation model (like OLS reg) one can avoid
> the
> > > mse1 option by replacing e(V) with e(V)/(e(rss)/e(df_r)). however that
> > > doesn't work for reg3 either since I have multiple equations and a VC
> matrix
> > > for all X of all equations but each equation of course has different RSS
> and
> > > df_r.
> > >  I cannot compute the scores either since this is a 3SLS model and not
> > > MLE...
> > >
> > >
> >
> >
> >
> >
>
>  --
>  Vera E. Troeger
>  Director, Essex Summer School in Social Science Data Analysis
>  Lecturer in Political Science
>  Government Department
>  University of Essex
>  Wivenhoe Park
>  Colchester CO4 3SQ
>  UK
>
>  phone: +44 (0)1206 872509
>  email: vtroe@essex.ac.uk
>  webpage: http://privatewww.essex.ac.uk/~vtroe
>
>
>  *
>  *   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/
>

--
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/