Skip to content
Prev 220287 / 398500 Next

Robust SE & Heteroskedasticity-consistent estimation

On Tue, 11 May 2010, Arne Henningsen wrote:

            
Ah, I didn't realize that the request could have been about the "maxLik" 
package (as opposed to generic maximum likelihood estimation).

Yes, bread() should be easy and estfun() is also easy provided you have 
analytical gradients.

The bread() method can simply return
   vcov(x) * number_of_observations

The estfun() method should return an n x k matrix (n = #obs, k = #par) 
where each row contains the gradient contribution of the corresponding 
observation. Thus
   colSums(estfun(x))
would correspond to
   x$gradient
You typically only get the latter from numerical gradients, but with 
analytical gradients you can easily evaluate it observation-wise.

With these two methods available, you can then call
   sandwich(x)
   sandwich(x, adjust = TRUE)
which computes the basic robust standard errors. In HC terminology, these 
are the HC0 and HC1 estimators.

Calling vcovHC() is more difficult because you have to assure that the 
model is based on a single linear predictor. Also I'm not sure about the 
applicability of HC2-HC4 outside the linear regression model.

For more details, see the "sandwich" vignettes.

Best,
Z