[R] Trouble with glm() .... non-integer #successes in a binomial glm

Thomas Lumley tlumley at u.washington.edu
Wed Apr 19 17:50:47 CEST 2006


On Wed, 19 Apr 2006, Smith, Phil wrote:

> Hi R-people:
>
> When I use the command to fit a model with an intercept, only:
>
> glm ( formula=haspdata ~ 1, data=dat, family=binomial, weights=
> dat$hy.wgt.s, subset=(dat$haspdat0!=3) )
>
> I get the message:
>
> Warning message:
> non-integer #successes in a binomial glm! in: eval(expr, envir, enclos)

The weights in a binomial glm are binomial denominators, and glm() is 
pointing out that when it multiplies the supplied outcome variable by the 
weight it doesn't get an integer.

You can get around this by using family=quasibinomial(), but this still 
assumes that the weights are precision weights.  If they are probability 
weights you need to use either survey::svyglm or something like 
Design::robcov.

 	-thomas

>
> Does anyone know what this means?? The data for this command is listed
> below.
>
> Thanks,
> Phil Smith
> CDC
>
> dat.hy.wgts.s
> Here is my data:
>> table( dat$haspdata )
>    0     1
> 21890  9097
>> is.integer( dat$haspdata )
> [1] TRUE
>
> dat$hy.wgt.s
>> summary( dat$hy.wgt.s)
>    Min.  1st Qu.   Median     Mean  3rd Qu.     Max.
> 0.003374 0.657700 0.874200 1.000000 1.204000 8.557000
>
>
> dat$haspdat0
>> table(dat$haspdat0)
>    1     2     3
> 21890  8989   108
>
>> is.integer( dat$haspdat0 )
> [1] TRUE
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

Thomas Lumley			Assoc. Professor, Biostatistics
tlumley at u.washington.edu	University of Washington, Seattle




More information about the R-help mailing list