The file glmweave.R contains
code to compute WEAVE standard errors inS-PLUS or R for generalised linear models fitted
to time series or data with crossed random effects, and code for sandwich
varianceestimators for clustered and longitudinal data.
To use the code load it with the source() command. All the functions take a glm object
as the main argument and return either a covariance matrix or a list containing a
covariance matrix, bias correction and approximate degrees of freedom. Complete on-line
documentation in HTML, S-PLUS or R format is available from:
http://www.biostat.washington.edu/~thomas/weave.html
jack.glm(glm.object,groups),infjack.glm(glm.object,groups)
Variance estimates for independence working models fitted to clustered data. The first
is based on the one-step jackknife, the second is the GEE sandwich estimator based on the
infinitesimal jackknife.
newey.west.glm(glm.object,times,lag,clag)
Newey-West estimator for estimating equations fitted to time seriesdata. The truncation
lag (lag=) optimally increases as the cube root of sample size, you can specify the
multiplier (clag=) instead of lag=.
kernelvar.glm<-function(glm.obj,times, lag=NULL,clag=NULL,
kernel=c("tukey","bartlett","parzen"))
Estimator based on specified weight function: "bartlett" gives Newey-West
estimator, other two are better. If clag= is specified the truncation lag is clag*n^a
where a=1/3 for "bartlett", 1/5 for the other kernels.
weightvar.glm<-function(glm.obj,times,weights)
Roll your own. Specify a vector of weights for lags 0:M weave.trunc(glm.obj,times,
lag=NULL, ctrunc=4)weighted empirical adaptive variance estimate with weights
(n*rho^2>ctrunc) or with weights 1 up to lag=lag, 0 further away
weave.smooth(glm.obj,times,csmooth=1) weighted empirical adaptive variance estimate with
weightsmin(1,csmooth*N*rho^2)
lele.glm(glm.obj,times,lag)
One-step version of Lele's estimating equation jackknife for time series.
xeffect.glm(glm.obj,g1,g2)
Sandwich standard errors for a crossed design where observations are correlated if they
share the same value of g1 or of g2. Unbalanced or incomplete designs are fine.
contact address:
T. Lumley
Department of Biostatistics
University of Washington
Box 357232
Seattle
WA 98195-7232
USA
E-mail: thomas@biostat.washington.edu