[R] glm(weights) and standard errors
David Winsemius
dwinsemius at comcast.net
Tue May 22 05:36:41 CEST 2012
On May 21, 2012, at 10:58 PM, Steve Taylor wrote:
> Is there a way to tell glm() that rows in the data represent a
> certain number of observations other than one? Perhaps even
> fractional values?
>
> Using the weights argument has no effect on the standard errors.
> Compare the following; is there a way to get the first and last
> models to produce the same results?
>
> data(sleep)
> coef(summary(glm(extra ~ group, data=sleep)))
> coef(summary(glm(extra ~ group, data=sleep,
> weights=rep(10L,nrow(sleep)))))
Here's a reasonably simple way to do it:
coef(summary(glm(extra ~ group, data=sleep[ rep(10L,nrow(sleep)), ] )))
--
David.
> sleep10 = sleep[rep(1:nrow(sleep),10),]
> coef(summary(glm(extra ~ group, data=sleep10)))
> coef(summary(glm(extra ~ group, data=sleep10,
> weights=rep(0.1,nrow(sleep10)))))
>
> My reason for asking is so that I can fit a model to a stacked
> multiple imputation data set, as suggested by:
>
> Wood, A. M., White, I. R. and Royston, P. (2008), How should
> variable selection be performed with multiply imputed data?.
> Statist. Med., 27: 3227-3246. doi: 10.1002/sim.3177
>
> Other suggestions would be most welcome.
>
> _______________________________________________
>
> Steve Taylor
> Biostatistician
> Pacific Islands Families Study
> Faculty of Health and Environmental Sciences
> AUT University
>
> ______________________________________________
> 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.
David Winsemius, MD
West Hartford, CT
More information about the R-help
mailing list