[R-sig-ME] problem extracting main effects from an updated glmm

Mariano Devoto mdevoto at agro.uba.ar
Tue Jun 7 19:31:10 CEST 2016

Dear all,

we are trying to use a glmm to analyze sampling completeness of
interactions in ecological networks based on a literature review of several
studies each of which simultaneously sampled a given number of networks.
Our response variable is the number of interactions observed (Sobs)
compared to the number missed (Smiss).
Our explanatory variables are:
int_type: type of interaction (categorical)
n_webs: number of networks studied at the same time in each study
n_int: number of interactions sampled in each network (numerical)
sp_num: number of species in each network
We have random effects associated to each study ("datum") which are nested
within each research group ("author"). We hope this will account for
inherent methodological differences between research groups and
uncontrolled ecological background noise for each study.
After some exploratory analysis (following protocols in Zuur's books) we
also included in the model an interaction term ("int_type:sp_num").

After much reading (books, blogs and other online help) this is what we've
managed to put together. As this is the first time we are using glmm in our
research group, in addition to the particular problem we are having with
extracting the model's main effects (see below) we would greatly appreciate
any comments/suggestions to improve our general approach. So here's the

#read data online
my.table <- read.csv(file = "

#Initial glmm
M0 <- glmer(cbind(Sobs, Smiss) ~ int_type + n_webs + n_int + sp_num +
int_type:sp_num + (1 | author/datum), data = my.table, family = binomial)

#Rescale explanatory variables after the function suggests to do so
my.table$n_webs.center <- scale(my.table$n_webs, center = T, scale = T)
my.table$n_int.center <- scale(my.table$n_int, center = T, scale = T)
my.table$sp_num.center <- scale(my.table$sp_num, center = T, scale = T)

#New model with rescaled variables
M1 <- glmer(cbind(Sobs, Smiss) ~ int_type + n_webs.center + n_int.center +
sp_num.center + int_type:sp_num.center + (1 | author/datum), data =
my.table, family = binomial)

# As there seem to be convergence problems, we followed this tutorial to
deal with them:
#Restarting the model seems to solve things
ss <- getME(M1, c("theta", "fixef"))
M2 <- update(M1, start = ss, control = glmerControl(optCtrl = list(maxfun =

#When we try to extract the main effects is when we run into trouble
my.effects <- allEffects(M2)

We looked extensively online, but can't find a solution to get beyond this
point. Any ideas would be most welcome.

Best wishes,


*Dr. Mariano Devoto*

Profesor Adjunto - Cátedra de Botánica General, Facultad de Agronomía de la
Investigador Adjunto del CONICET

Av. San Martín 4453 - C1417DSE - C. A. de Buenos Aires - Argentina
+5411 4524-8069

	[[alternative HTML version deleted]]

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