[R] glm(weights) and standard errors

Steve Taylor steve.taylor at aut.ac.nz
Thu May 24 03:49:24 CEST 2012


Re:
coef(summary(glm(extra ~ group, data=sleep[ rep(1:nrow(sleep), 10L), ] )))

Your (corrected) suggestion is the same as one of mine, and doesn't do what I'm looking for.


-----Original Message-----
From: David Winsemius [mailto:dwinsemius at comcast.net] 
Sent: Tuesday, 22 May 2012 3:37p
To: Steve Taylor
Cc: r-help at r-project.org
Subject: Re: [R] glm(weights) and standard errors


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.
>



More information about the R-help mailing list