Solved – use binomial distribution for beta distribution when using lme4 package (glmer function)

beta distributionbinomial distributionlme4-nlmemeta-analysismixed model

I am conducting a meta-analysis dealing with the proportional data. I would like to use "proportional mean scores (0-100%; mean scores divided by the maximum test score" as a response variable and weight using inverse variance (1/variance). I also would like to use multilevel modeling because some of the response variables are nested in each article. I am thinking the simplest command for the glmer function will be like this:

res <- glmer (proportional_mean_score ~ moderator1 * moderator2 +(1|article_number), family = binomial (link=logit), weights = 1/variance, data = dat))

I was told that I should be using the beta distribution instead of binomial, and weights should represent the total of total count for the proportion. However, I cannot find any package which let me use beta-distribution while specifying the weights and random effects. I first tried with the lmer function but the estimation values go beyond 100%, so I decided to use glmer function with binomial distribution. Can I just use the glmer function in the lme4 package and weight with variance instead of the total counts or maximum scores?


I was told that I do not have to stick with the lme4 package; instead, I was recommended to use the brains package. https://journal.r-project.org/archive/2018/RJ-2018-017/RJ-2018-017.pdf

Uing the brms package, I can use bata models while specifying random effects. One flip side would be that I have to learn how to interpret the results from the Bayesian perspective.

I guess this question does not seem to attract that much attention. However, in case, some one who got to my question wondering the same thing, I would like to share what I learned.

P.S.
No offence to the lme4 package. I like lme4 a lot too.

Best Answer

The beta mixed effects model is available in the GLMMadaptive; for an example, check here (the purpose of the example is to show how you can define a user-specified family object; in your case you could directly use mixed_model(..., family = beta.fam())).

To account for the differences in the total counts you could perhaps consider adding an offset instead of a weight.