Re: [R] Huber-white cluster s.e. after optim?

From: Achim Zeileis <>
Date: Tue, 15 Apr 2008 00:57:02 +0200 (CEST)


> Hi Achim: Thanks for the reply! I did notice that robcov() requires
> the X & Y and also a scores vector and that these are not readily
> available under fixed names or at all in output from such functions as
> systemfit and optim. I wonder if it would make sense to have a
> stop-gap function that would allow the user to specify ingredients
> needed to construct the sandwich from varying components available in
> such functions as systemfit or optim, assuming the ingredients are
> available? Wish I knew more about how sandwiches are constructed.

The "sandwich" package comes with some vignettes about this   vignette("sandwich", package = "sandwich")   vignette("sandwich-OOP", package = "sandwich") Especially the latter discusses some unifying properties of sandwich covariances and how they are implemented in an object-oriented fashion in "sandwich".

To use this object-oriented structure, you need to provide a bread() method (which you can compute from the Hessian if you use optim()) and an estfun() method containing the empirical gradients.

For a clustered version of the sandwiches, I would need an additional method for passing on the clustering vector which I haven't got a good object-oriented solution for...

For (generalized) linear models, the standard clustered sandwiches are available in the GEE packages for R, e.g., "geepack".

> Incidentally, thanks again for putting in the symbolic method of
> specifying linear hypothesis tests. I have been using that
> extensively.

:-) great, thanks for the feedback!

> Cheers, Peter
> On Mon, Apr 14, 2008 at 6:52 AM, Achim Zeileis
> <> wrote:
> > On Thu, 10 Apr 2008, Peter Muhlberger wrote:
> >
> > This is on my wishlist for "sandwich" for a long time. Conceptually, it is
> > quite straightforward, but I'm not quite sure how to implement it because
> > AFAIK there is no unified way of extracting clustering information from
> > fitted regression objects.
> > Z
> >
> > > Peter
> > >
> > > _______
> mailing list PLEASE do read the posting guide and provide commented, minimal, self-contained, reproducible code. Received on Mon 14 Apr 2008 - 22:57:47 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 14 Apr 2008 - 23:30:29 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive