[R] analysis of data with observation weights

Thomas Lumley tlumley at u.washington.edu
Fri Nov 15 16:35:13 CET 2002

On Thu, 14 Nov 2002, John Fox wrote:

> Dear Michal,
> As far as I know (and I'd be happy to be wrong), there's no *general* way
> of introducing case weights in R. The glm function, however, accommodates
> case weights via its weights argument, and this might be sufficient to do
> what you want to do. You'll have to be careful with inferences, though.

The weights argument to lm and glm will give the right point estimates.
The standard errors  will potentially be wrong.  This can be fixed with
`sandwich' standard errors, so one option is to use gee() with each
observation being in a `group' on its own. Similarly, the `robust'
standard errors in coxph() will allow probability-weighted survival

The sandwich standard errors used by gee() are not quite the same as the
ones used by survey samplers, but they are very similar and they are
consistent estimates of the same thing.

The usual linear model standard errors are often pretty good even for
probability weighting as long as  important covariates aren't strongly
associated with the weights.


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