[R-sig-ME] "General" (non-Bernoulli) binomial models in GLMMadaptive.
D. Rizopoulos
d@r|zopou|o@ @end|ng |rom er@@mu@mc@n|
Sun Aug 4 12:10:33 CEST 2019
The current CRAN version of GLMMadaptive should work for binomial data. For example, this run in my machine:
library("GLMMadaptive")
library("lme4")
system.time(fm1 <- glmer(cbind(incidence, size - incidence) ~ period + (1 | herd),
data = cbpp, family = binomial, nAGQ = 21))
system.time(gm1 <- mixed_model(cbind(incidence, size - incidence) ~ period, random = ~ 1 | herd,
data = cbpp, family = binomial(), nAGQ = 21))
summary(fm1)
summary(gm1)
Best,
Dimitris
-----Original Message-----
From: Rolf Turner <r.turner using auckland.ac.nz>
Sent: Sunday, August 4, 2019 11:01 AM
To: D. Rizopoulos <d.rizopoulos using erasmusmc.nl>
Cc: R-mixed models mailing list <r-sig-mixed-models using r-project.org>
Subject: "General" (non-Bernoulli) binomial models in GLMMadaptive.
I am just now launching forth into the use of the GLMMadaptive package.
As far as I can discern, from reading the help for mixed_model() and the vignette GLMMadaptive_basics, the package can only fit *Bernoulli* models in the binomial() family. Is my reading correct? Will more general binomial models be added in the future?
The only way that I can see as of the present, to fit a general model, is to replicated each row of the relevant data frame "nsucc" and "nfail" times (where "nsucc" and "nfail" are the respective numbers of successes and failures corresponding to the given row). The y-value corresponding to each of the "nsucc" replicates would be 1 and that corresponding to each of the "nfail" replicates would be 0.
While this strategy is, I guess, perfectly do-able, it seems to me to be somewhat wasteful and could lead to a data frame of unwieldy size if the numbers of trials in the original data were at all large.
My other thought was to take y to be the *proportion* of successes and set a weights argument equal to the number of trials (as one can apparently do with glm() --- I've never actually tried this!). However it seems that mixed_model() does not have a "weights" argument.
Advice gratefully received.
cheers,
Rolf
Added in press ( :-) ): I have just discovered that mixed_model() in the "development version" of GLMMadaptive, on github, *does* have a weights argument. I shall now install the development version and experiment.
I would however still appreciate comments and advice. E.g. will the weights argument in mixed_model() work in the way that I am hoping? Is this the recommended approach to fitting a "general" binomial model?
Thanks.
R.
--
Honorary Research Fellow
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276
More information about the R-sig-mixed-models
mailing list