[R-sig-ME] glmer with nAGQ > 1
Joshua Wiley
jwiley.psych at gmail.com
Mon Jul 15 19:59:08 CEST 2013
Hi Wolfgang,
Another good option would be to use MCMCglmm. It could look something like:
set.seed(1234)
dat <- mtcars[sample(1:32, 1000, replace = TRUE), ]
dat <- within(dat, {
qsec <- scale(qsec)
hp <- scale(hp)
mpg <- scale(mpg)
disp <- scale(disp)
})
dat$ID <- factor(rep(letters, length.out = 1000))
m <- MCMCglmm(vs ~ hp, random = ~ idh(1 + hp):ID, family = "categorical",
data = dat, prior = list(
B = list(mu = c(0, 0), V = diag(2) * 1e10),
R = list(V = 1, fix = 1),
G = list(G1 = list(V = diag(2), nu = .002))), pr=TRUE,
nitt = 55000, thin = 100, burnin = 5000, verbose=FALSE)
Just up the number of iterations if you want more precision. Jarrod
Hadfield's course notes are a great introduction.
Cheers,
Josh
On Sun, Jul 14, 2013 at 5:04 AM, Viechtbauer Wolfgang (STAT)
<wolfgang.viechtbauer at maastrichtuniversity.nl> wrote:
> Thanks for the reply. I wasn't aware of the fact that lme4.0/old-lme4 only allowed one grouping variable with nAGQ > 1, but I just tried that out and that is indeed the case. My more pressing concern with the new lme4 however is the possibility of allowing for nonscalar random effects terms. I frequently fit logistic regression models with multiple random effects (like a random intercept for individuals/clusters and a random effect on a dummy variable to allow for variable treatment effects). It would be great to still benefit from the increased accuracy of nAGQ > 1 then. It would be nice if that could be put on the to-do list, but I know from personal experience how those to-do lists have a tendency just to get longer than shorter over time.
>
> Best,
> Wolfgang
>
>> -----Original Message-----
>> From: r-sig-mixed-models-bounces at r-project.org [mailto:r-sig-mixed-models-
>> bounces at r-project.org] On Behalf Of Ben Bolker
>> Sent: Thursday, July 11, 2013 17:36
>> To: r-sig-mixed-models at r-project.org
>> Subject: Re: [R-sig-ME] glmer with nAGQ > 1
>>
>> Viechtbauer Wolfgang (STAT <wolfgang.viechtbauer at ...> writes:
>>
>> > I just tried to fit a mixed-effects logistic regression model with
>> > version 0.99999911-5 of lme4 (installed from github). The model
>> > includes a random effect for clusters and a random group/treatment
>> > effect. I received the following error:
>>
>> > Error in updateGlmerDevfun(devfun, glmod$reTrms, nAGQ = nAGQ) : nAGQ
>> > > 1 is only available for models with a single, scalar
>> > random-effects term
>>
>> > Indeed, I had set nAGQ > 1 to get more precision with the evaluation
>> > of the integrals via Gauss-Hermite quadrature. It's clear what the
>> > error message says, but I am wondering if this is going to be a
>> > permanent design choice or something temporary.
>>
>> It's probably a "foreseeable future" decision (alas).
>>
>> I don't know the guts of the AGQ calculation tremendously well,
>> so I don't know exactly what would be involved in constructing
>> a multi-dimensional AGQ. Taking a brief look back at lme4.0/old-lme4,
>> it seems that only a single _grouping variable_ was allowed, but
>> it was not limited to scalar random effects terms, so it might
>> not be too horrible to re-implement ... but it's not on the
>> urgent "to do" list at the moment ... (Anyone want to volunteer
>> to take a look at the code and implement this ???)
>>
>> Ben
>>
>> _______________________________________________
>> R-sig-mixed-models at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
--
Joshua Wiley
Ph.D. Student, Health Psychology
University of California, Los Angeles
http://joshuawiley.com/
Senior Analyst - Elkhart Group Ltd.
http://elkhartgroup.com
More information about the R-sig-mixed-models
mailing list