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

Bill.Venables at csiro.au Bill.Venables at csiro.au
Thu Apr 10 04:02:06 CEST 2008


optim is a general purpose optimiser.  You don't reallly use it to
'analyze' data and you cannot get a variance matrix directly from the
result, even using vcov.  If you ask, it will give you the hessian
matrix of the objective function at the optimum value, from which you
can get a variance matrix if you wish, provided the objective function
that you optimised was the negative of a log-likelihood function.

So the recommended way of going about things in your case is probably
a) calculate the negative log-likelihood from the non-independence
model that accommodates the kind of clustering you suspect may be
happening, b) use optim to optimise it, requesting the hessian and c)
invert the hessian to get the variance matrix.

In many cases a) often looks difficult, but on closer inspection turns
out to be impossible, (typicall because it involves too much numerical
integration).  In this case you need to use an alternative approach
which probably will not involve using optim at all.

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
On Behalf Of Peter Muhlberger
Sent: Thursday, 10 April 2008 10:16 AM
To: r-help at stat.math.ethz.ch
Subject: [R] Huber-white cluster s.e. after optim?

I've used optim to analyze some data I have with good results, but
need to correct the var-cov matrix for possible effects of clustering
of observations (respondents) in small groups (non-independence).  Is
there any function to adjust the matrix?  I heard some time ago that
the vcovHC function would have a cluster capability added to it, but I
don't see that in my fairly recent version.

Cheers, 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