[R] Robust SE & Heteroskedasticity-consistent estimation
Achim Zeileis
Achim.Zeileis at uibk.ac.at
Tue May 11 10:21:13 CEST 2010
On Tue, 11 May 2010, Arne Henningsen wrote:
> On 11 May 2010 00:52, Achim Zeileis <Achim.Zeileis at uibk.ac.at> wrote:
>> On Mon, 10 May 2010, RATIARISON Eric wrote:
>>> I'm using maxlik with functions specified (L, his gradient & hessian).
>>>
>>> Now I would like determine some robust standard errors of my estimators.
>>>
>>> So I 'm try to use vcovHC, or hccm or robcov for example
>>>
>>> but in use one of them with my result of maxlik, I've a the following
>>> error message :
>>>
>>> Erreur dans terms.default(object) : no terms component
>>>
>>> Is there some attributes to give to maxlik objet for "fitting" the call
>>> of vcovHC?
>>
>> This is discussed in
>> vignette("sandwich-OOP", package = "sandwich")
>> one of the vignettes accompanying the "sandwich" package that provides the
>> vcovHC() function. At the very least, you need an estfun() method which
>> extracts the gradient contributions per observation. Then you need a bread()
>> function, typically based on the observed Hessian. Then you can compute the
>> basic sandwich() estimators.
>
> Is it possible to implement the estfun() method and the bread()
> function in the maxLik package so that vcovHC() can be easily used by
> all users of the maxLik package? If yes: should we (Eric, Achim, Ott,
> Arne) implement this feature together?
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
> /Arne
>
> --
> Arne Henningsen
> http://www.arne-henningsen.name
>
More information about the R-help
mailing list