[R-sig-ME] How to know if random intercepts and slopes are necessary for glmer.nb model

David Jones david.tn.jones at gmail.com
Mon Oct 19 14:59:40 CEST 2015


I am receiving a number of different warnings/errors when running glmer.nb
on a fairly large dataset (N>500,000). For some of the models I have run,
program-reported errors prevent the generation of estimates. I suspect that
it is because the random effects are very small. I have tried models with
random intercepts, as well as models with both random intercepts and slopes
(all models include fixed effects). I am running models on a dataset which
in theory would include random effects (patients nested within hospitals).

My question is: how do you know if random intercepts and slopes are
necessary, if you can't even estimate the random effects models (and thus
use a model comparison test)? As I am aware you can look at design effects
to evaluate if a random intercept is necessary (though please correct me if
I am wrong here).

Some example code I have used is below - many thanks.

a2 <- as.factor(analysis$Location)
NBIntercept<- glmer.nb(y ~ a2 + (1 | Hospital), data = analysis)
NBInterceptSlope <- glmer.nb(y ~ a2 + (1 | Hospital) + (1 + a2 | Hospital),
data = analysis)

	[[alternative HTML version deleted]]



More information about the R-sig-mixed-models mailing list