[R] glm(weights) and standard errors

ilai keren at math.montana.edu
Fri May 25 09:21:16 CEST 2012


I'm confused (I bet David is too). First and last models are "the
same", what do SE's have to do with anything ?

naive <- glm(extra ~ group, data=sleep)
imputWrong <- glm(extra ~ group, data=sleep10)
imput <- glm(extra ~ group, data=sleep10,weights=rep(0.1,nrow(sleep10)))
lapply(list(naive,imputWrong,imput),anova)
sapply(list(naive,imuptWrong,imput),function(x) vcov(x)[1,1]/vcov(x)[2,2])
# or another way to see it  (adjust for the DF)
coef(summary(naive))[2,2] - sqrt(198)/sqrt(18) * coef(summary(imput))[2,2]
coef(summary(naive))[2,2] - sqrt(198)/sqrt(18) * coef(summary(imputWrong))[2,2]

Are you sure you are interpreting Wood et al. correctly ? (I haven't
read it, this is not rhetorical)

On Wed, May 23, 2012 at 7:49 PM, Steve Taylor <steve.taylor at aut.ac.nz> wrote:
> 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.
>>
>
> ______________________________________________
> 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.



More information about the R-help mailing list