[R] Warning message: In eval(expr, envir, enclos) : non-integer #successes in a binomial glm!

Simon Kiss sjkiss at gmail.com
Mon Dec 10 14:40:20 CET 2012


Hi there 
I'm trying to fit a logistic regression model to data that looks very similar to the data in the sample below.   I don't understand why I'm getting this error; none of the data are proportional and the weights are numeric values.  Should I be concerned about the warning about non-integer successes in my binomial glm? If I should be, how do I go about addressing it?
I'm pretty sure the weights in the data frame are sampling weights.  

What follows is the result of str() on my data, the series of commands I'm using to fit the model, the responses I'm getting and then some code to reproduce the data and go through the same steps with that code.  One last (minor) question.  When calling svyglm on the sample data, I actually get some information about the model fitting results as well as the error about non-integer successes.  In my real data, you only get the warning. Calling summary(mod1) on the real data does return information about the coefficients and the model fitting.

I'm grateful for any help. I'm aware that the topic of non-integer successes has been addressed before, but I could not find my answer to this question.

Yours, Simon Kiss

######str() on original data
str(mat1)
'data.frame':	1001 obs. of  5 variables:
 $ prov  : Factor w/ 4 levels "Ontario","PQ",..: 2 2 2 2 2 2 2 2 2 2 ...
 $ edu   : Factor w/ 2 levels "secondary","post-secondary": 2 2 2 1 1 2 2 2 1 1 ...
 $ gender: Factor w/ 2 levels "Male","Female": 1 1 2 2 2 2 1 1 2 2 ...
 $ weight: num  1.145 1.436 0.954 0.765 0.776 ...
 $ trust : Factor w/ 2 levels "no trust","trust": 2 1 1 1 1 2 1 2 1 2 ...

#######Set up survey design
des.1<-svydesign(~0, weights=~weight, data=mat1)

#######model and response to svyglm
mod1<-svyglm(trust ~ gender+edu+prov, design=des.1, family='binomial')

Warning message:
In eval(expr, envir, enclos) : non-integer #successes in a binomial glm!

########Model Summary
summary(mod1)

Call:
svyglm(formula = trust ~ gender + edu + prov, design = des.1, 
    family = "binomial")

Survey design:
svydesign(~0, weights = ~weight, data = mat1)

Coefficients:
                   Estimate Std. Error t value Pr(>|t|)    
(Intercept)       -0.625909   0.156560  -3.998 6.87e-05 ***
genderFemale       0.013519   0.140574   0.096    0.923    
edupost-secondary -0.011569   0.141528  -0.082    0.935    
provPQ            -0.006614   0.172105  -0.038    0.969    
provatl            0.335166   0.297860   1.125    0.261    
provwest          -0.053862   0.174826  -0.308    0.758    
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 

(Dispersion parameter for binomial family taken to be 1.002254)

Number of Fisher Scoring iterations: 4




#########Attempt To Reproduce The Problem
########Data
mat.test<-data.frame(edu=c(rep('secondary', 300), rep('post-secondary', 300)), prov=c(rep('ON', 200), rep('PQ', 200), rep('AB', 200)), trust=c(rep('trust',200), rep('notrust',400)), gender=c(rep('Male', 300), rep('Female', 300)), weight=rnorm(600, mean=1, sd=0.3))
#######Survey Design object
test<-svydesign(~0, weights=~weight, data=mat.test)

#####Call To svyglm
svyglm(trust ~ edu+prov+gender, design=test, family='binomial')

#Reults
Independent Sampling design (with replacement)
svydesign(~0, weights = ~weight, data = mat.test)

Call:  svyglm(formula = trust ~ edu + prov + gender, design = test, 
    family = "binomial")

Coefficients:
 (Intercept)  edusecondary        provON        provPQ    genderMale  
  -2.658e+01    -8.454e-04     5.317e+01    -1.408e-02            NA  

Degrees of Freedom: 599 Total (i.e. Null);  596 Residual
Null Deviance:	    759.6 
Residual Deviance: 3.406e-09 	AIC: 8 
Warning messages:
1: In eval(expr, envir, enclos) :
  non-integer #successes in a binomial glm!
2: glm.fit: algorithm did not converge 
*********************************
Simon J. Kiss, PhD
Assistant Professor, Wilfrid Laurier University
73 George Street
Brantford, Ontario, Canada
N3T 2C9



More information about the R-help mailing list