I have a repeated-measures experiment where the dependent variable is a percentage, and I have multiple factors as independent variables. I'd like to use glmer from the R package lme4 to treat it as a logistic regression problem (by specifying family=binomial) since it seems to accommodate this setup directly.

My data looks like this:

 > head(data.xvsy)
   foldnum      featureset noisered pooldur dpoolmode       auc
 1       0         mfcc-ms      nr0       1      mean 0.6760438
 2       1         mfcc-ms      nr0       1      mean 0.6739482
 3       0    melspec-maxp    nr075       1       max 0.8141421
 4       1    melspec-maxp    nr075       1       max 0.7822994
 5       0 chrmpeak-tpor1d    nr075       1       max 0.6547476
 6       1 chrmpeak-tpor1d    nr075       1       max 0.6699825

and here's the R command that I was hoping would be appropriate:

 glmer(auc~1+featureset*noisered*pooldur*dpoolmode+(1|foldnum), data.xvsy, family=binomial)

The problem with this is that the command complains about my dependent variable not being integers:

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

and the analysis of this (pilot) data gives weird answers as a result.

I understand why the binomial family expects integers (yes-no counts), but it seems it should be OK to regress percentage data directly. How to do this?

  • 1
    $\begingroup$ It doesn't seem OK to me, as 5 out of 10 isn't the same information as 500 out of 1000. Express the response as one count of the no. "successes" & one count of the no. "failures". $\endgroup$ Commented Feb 26, 2014 at 14:03
  • $\begingroup$ @Scortchi thanks, I think you may be right. I was thinking in part about the continuous nature of my percentages (derived from probabilistic decisions) similar to this question: stats.stackexchange.com/questions/77376/… but I believe I can express my data via a meaningful conversion to integer counts. $\endgroup$ Commented Feb 26, 2014 at 14:46
  • $\begingroup$ See also stats.stackexchange.com/questions/216122/… $\endgroup$ Commented Dec 11, 2022 at 0:11

2 Answers 2


In order to use a vector of proportions as the response variable with glmer(., family = binomial), you need to set the number of trials that led to each proportion using the weights argument. For example, using the cbpp data from the lme4 package:

glmer(incidence / size ~ period + (1 | herd), weights = size,
   family = binomial, data = cbpp)

If you do not know the total number of trials, then a binomial model is not appropriate, as is indicated in the error message.

  • $\begingroup$ I can't say whether using weights for this works or not. But you certainly can input the data as a two column matrix (successes/failures) on the left hand side of the formula. $\endgroup$
    – ndoogan
    Commented Feb 26, 2014 at 22:15
  • $\begingroup$ But @ndoogan, the original question was about proportions, not successes/failures. And the above code does work, as I took it from the cbpp help page. $\endgroup$ Commented Feb 26, 2014 at 23:37
  • $\begingroup$ Fair enough. Though, I intended to mean successes/failures (not intended to be division) is where the proportions for a binomial model come from. $\endgroup$
    – ndoogan
    Commented Feb 27, 2014 at 2:45
  • $\begingroup$ +1 but readers might want to see @BenBolker's answer here stats.stackexchange.com/questions/189115 about possible ways to deal with overdispersion. $\endgroup$
    – amoeba
    Commented Sep 14, 2016 at 14:12

If your response is a proportion, percentage or anything similiar that can only take values in $(0,1)$ you would typically use beta regression, not the binomial one.

  • 4
    $\begingroup$ A binomial model is a model of proportions. Though, it's only appropriate when you know the number of trials. If all you have is a percent with no indication of the number of trials, then I believe you are correct that beta regression is appropriate. $\endgroup$
    – ndoogan
    Commented Feb 27, 2014 at 2:47
  • $\begingroup$ @ndoogan To clarify, my advice is not "use beta regression when your response is a proportion" but rather "if your response can only take values in $(0,1)$ such as proportions/percentages then beta regression is typical" $\endgroup$
    – M. Berk
    Commented Feb 27, 2014 at 10:51
  • $\begingroup$ Thanks, this is a good point. I'm accepting the other answer because it answers the question as written, but the point about beta regression is well made so I've upvoted it. $\endgroup$ Commented Feb 27, 2014 at 12:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.