[R] glm and Newey-West estimator

Thomas Lumley tlumley at u.washington.edu
Tue Oct 15 23:34:53 CEST 2002

On Tue, 15 Oct 2002, Jun Yan wrote:

> On Tue, 15 Oct 2002, Christof Bigler wrote:
> > Dear R-users,
> >
> > has anybody combined the glm function with the Newey-West estimator of
> > variance, similar as in Stata 7.0? I'd like to estimate corrected
> > standard errors within a logistic regression model, taking into account
> > the auto-correlated binary observations within individuals.
> > I use R1.5.1 on Mac OS X (10.2).
> >
> > Thanks,
> > Christof
> Alternatively, you may try package geepack, which can model the ar1
> correlation structure within a cluster. I am not sure if this Newey-West
> estimator is the same as the "sandwich" variance estimator though. Maybe
> someone knows this better can explain.

It's not the same, though it's a similar idea.  The gee version of
sandwich estimator uses the fact that observations on different clusters
are independent to get a variance estimator.

In time series there aren't any fully independent replicates, and
using the same formula as for longitudinal data will give 0 for your
standard errors. Roughly speaking, the Newey-West estimator involves
chopping the time series into pieces long enough to be approximately
independent and then treating them as clusters.  In fact it's more elegant
than that, but that gives a fairly accurate heuristic idea.


r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list