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

Achim Zeileis Achim.Zeileis at wu-wien.ac.at
Mon Apr 14 13:52:54 CEST 2008

On Thu, 10 Apr 2008, Peter Muhlberger wrote:

> Hi Bill:  Thanks for the reply!  As you've no doubt guessed, I'm not a
>  statistician (I'm a social scientist).  I hadn't given thought to
>  modeling the cluster-based covariance explicitly--interesting
>  possibility.  My responses are drawn from some 60 discussion groups,
>  and a critic of my current results might complain that there could be
>  error covariation within group (though I suspect there probably
>  isn't).  In Stata, the ml routine has a 'cluster' option that
>  generates Huber-White cluster standard errors for max. likelihood
>  estimates.  I was hoping something similar would be possible in R.  I
>  suppose another solution would involve specifically modeling error
>  covariance in optim, but it would be helpful if there was some example
>  of how to do this that I could examine.
>  Another, related problem I face is correcting for clustering in a
>  system of equations, estimated with systemfit using the OLS option (I
>  need to simultaneous estimation for subsequent hypothesis testing;
>  would be using SUR but for the cluster issue).  It seems that both
>  this problem and my optim problem might be solved if there was
>  something in R like a vcovHC that could handle clustered data--but
>  that's just a non-statistician's guess.

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.

>  Peter
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list