All Questions
297 questions
52
votes
2
answers
131k
views
Dealing with singular fit in mixed models
Let's say we have a model
...
47
votes
2
answers
77k
views
How can I test whether a random effect is significant?
I am trying to understand when to use a random effect and when it is unnecessary. Ive been told a rule of thumb is if you have 4 or more groups/individuals which I do (15 individual moose). Some of ...
35
votes
2
answers
41k
views
Why do I get zero variance of a random effect in my mixed model, despite some variation in the data?
We’ve run a mixed effects logistic regression using the following syntax;
...
31
votes
2
answers
98k
views
r glmer warnings: model fails to converge & model is nearly unidentifiable
I have seen questions about this on this forum, and I have also asked it myself in a previous post but I still haven't been able to solve my problem. Therefore I am trying again, formulating the ...
24
votes
2
answers
26k
views
How to apply binomial GLMM (glmer) to percentages rather than yes-no counts?
I have a repeated-measures experiment where the dependent variable is a percentage, and I have multiple factors as independent variables. I'd like to use glmer from ...
24
votes
1
answer
39k
views
Fitting a binomial GLMM (glmer) to a response variable that is a proportion or fraction
I'm hoping somebody can help with what I think is a relatively simple question, and I think I know the answer but without confirmation it has become something I just can't be certain of.
I have some ...
22
votes
5
answers
25k
views
How to assess the fit of a binomial GLMM fitted with lme4 (> 1.0)?
I have a GLMM with a binomial distribution and a logit link function and I have the feeling that an important aspect of the data is not well represented in the model.
To test this, I would like to ...
21
votes
1
answer
19k
views
How to fit a mixed model with response variable between 0 and 1?
I am trying to use lme4::glmer() to fit a binomial generalized mixed model (GLMM) with dependent variable that is not binary, but a continuous variable between zero ...
19
votes
2
answers
15k
views
Random effect equal to 0 in generalized linear mixed model [duplicate]
Sorry if I'm missing something very obvious here but I am new to mixed effect modelling.
I am trying to model a binomial presence/absence response as a function of percentages of habitat within the ...
19
votes
1
answer
7k
views
Meaning of a convergence warning in glmer
I am using the glmer function from the lme4 package in R, and I'm using the bobyqa optimizer ...
19
votes
2
answers
10k
views
How will random effects with only 1 observation affect a generalized linear mixed model?
I have a data set in which the variable I'd like to use as a random effect only has a single observation for some levels. Based on the answers to previous questions, I've gathered that, in principle, ...
14
votes
1
answer
16k
views
Calculating ICC for random-effects logistic regression
I'm running a logistic regression model in the form:
lmer(response~1+(1|site), family=binomial, REML = FALSE)
Normally I would calculate the ICC from the ...
13
votes
2
answers
5k
views
Are $R^2$ for GLMM useful for modelers but not necessarily for readers?
The short version:
1)Are there any published critiques of the use of $R^2$ for GLMMs, in particular the popular approach of Nakagawa & Schielzeth (2013) A general and simple method for obtaining $...
12
votes
2
answers
23k
views
How to test for overdispersion in Poisson GLMM with lmer() in R?
I have the following model:
> model1<-lmer(aph.remain~sMFS1+sAG1+sSHDI1+sbare+season+crop
+(1|landscape),family=poisson)
...and this is the summary ...
10
votes
1
answer
16k
views
Help interpreting count data GLMM using lme4 glmer and glmer.nb - Negative binomial versus Poisson
I have some questions regarding specification and interpretation of GLMMs. 3 questions are definitely statistical and 2 are more specifically about R. I am posting here because ultimately I think the ...
10
votes
3
answers
407
views
Bacteria picked up on fingers after multiple surface contacts: non-normal data, repeated measures, crossed participants
Intro
I have participants who are repeatedly touching contaminated surfaces with E. coli in two conditions (A=wearing gloves, B=no gloves). I want to know if there's a difference between the amount ...
10
votes
2
answers
21k
views
Should I use Poisson distribution for non-integer, count-like data?
It's my first question here, I hope I'll ask it correctly. I am trying to find out how to analyse non-integer, count data (yes!). I am looking at the effect of a given treatment on habitat suitability ...
9
votes
1
answer
13k
views
How to account for repeated measures in glmer?
My design is as follows.
$y$ is Bernoulli response
$x_1$ is a continuous variable
$x_2$ is a categorical (factor) variable with two levels
The experiment is completely within subjects. That is, ...
8
votes
1
answer
12k
views
Interactions between random effects
I'm considering a mixed-effects model to try to understand factors that influence the number of ticks sampled on wild rodents. My data is nested so that I have one tick count per rodent, multiple ...
8
votes
2
answers
6k
views
Modeling reaction time with glmer
According to Lo and Andrews, 2015 (https://doi.org/10.3389/fpsyg.2015.01171) raw Reaction Time (RT) should be analyzed with a GLMM, instead of transformed values with LMM or even ANOVA. They and ...
8
votes
1
answer
2k
views
GLMM overfitting solutions
in GLMM faq page http://glmm.wikidot.com/faq there is a statement about overfitting:
"One alternative (suggested by Robert LaBudde) is to "fit the model with the random factor as a fixed effect, get ...
8
votes
1
answer
790
views
Suspiciously high shrinkage in random effects logistic regression
Consider the following simple example:
...
8
votes
1
answer
4k
views
How does random variable nesting in GAMs work (mgcv)?
Consider me very new to the world of GAMs, I am actually using it out of necessity rather than by choice but I thought it could be a chance to learn something new anyway.
Originally I had hoped to ...
8
votes
1
answer
1k
views
How close to zero should the sum of the random effects be in GLMM (with lme4)
I'm using the lme4 package in R to do some logistic mixed-effects modeling.
My understanding was that sum of each random effects should be zero.
When I make toy ...
7
votes
2
answers
154
views
How can I get a best model? An exploratory LMM
I'd like to inquire about the linear mixed model and its application to my dataset. The dataset comprises a dependent variable (DV) denoted as V, alongside three ...
7
votes
2
answers
10k
views
R: How to fit a GLMM in nlme
I want to compare lme4 and nlme packages for my data. But I'm confused by how to use syntax in nlme. I'm working with Mixed-Effects Models in S and S-Plus (Pinheiro, Bates 2000) and the current ...
7
votes
2
answers
166
views
How can I use a variable as a covariate which exists only for specific range for some clusters/groups?
I want to know how to use Poisson GLMMs when we have unequal samples available for different groups/clusters/participants in data.
Imagine a study where each of the 60 participants are given 1000 ...
7
votes
2
answers
395
views
Don't understand why glmm random effect variance is zero. Have reviewed similar questions still dont get it
I study a colonially-nesting bird species. I am trying to perform an AICc evaluation of GLMMs for a nest site selection study. I collected data at nest sites and paired random sites. I want to ...
7
votes
1
answer
6k
views
Specifying model in glmer() - interaction terms
I am running a generalised mixed effects model, of family logistic regression, using function glmer().
I am predicting likelihood of response (0/1) and my fixed effects to explore in my final model ...
7
votes
1
answer
2k
views
How to calculate estimated proportions and their confidence intervals from a mixed model?
I have an experiment with two treatments. It is a split plot experiment, with the structure Block/Treatment1/Treatment2. Each treatment has 2 levels. The dependent variable is presence/absence data ...
7
votes
1
answer
135
views
Using proportions as a measure of nest success in a glmm
I want to run a GLMM to see if a conservation intervention had an effect on the nesting success of a shore-breeding bird. I'm comparing this against a control where no intervention was used. I used ...
7
votes
1
answer
3k
views
Do I need more than one random slope?
When constructing a GLMM in R, do I need more than one random slope if I "see" that slopes differ for multiple continuous variables?
In my case, I am analysing the number of plant species (...
7
votes
1
answer
1k
views
GLMM and two slopes
My outcome variable is binomial, and I have 11 independent variables and a time variable. The time variable has different slopes, so I fixed it to time-before and <...
7
votes
1
answer
263
views
General Linear Mixed Model: How do I fix 'Rescale variables? Model is nearly unidentifiable' error on glmer
I'm trying to fit a generalized linear mixed model (GLMM), but I'm getting a persistent error. I'm looking at the relationship between weather (continuous variables: rainfall, maxtemp, and mintemp) ...
7
votes
2
answers
1k
views
Translate glmer (lme4) model specification into MCMCglmm
I am having some computational trouble estimating the following model with the glmer function in lme4:
...
7
votes
1
answer
3k
views
GLMM - between, within and nested
I'm not entirely sure of fitting the model for experiment we've made. The variables and relevant description are as follows:
ID - participant ID
Trial - 60 for each participant
Memory - between ...
7
votes
1
answer
3k
views
Calculating confidence intervals of marginal means in linear mixed models
I'm using different R packages (effects, ggeffects, emmeans, ...
7
votes
1
answer
516
views
Should random effects be included in fitted values when making a binned residual plot for a binomial GLMM?
The binned residual plot in the R arm package is often recommended as a way to check if a logistic model is making any systematic errors. The general idea is that the mean residual for a group of ...
7
votes
1
answer
8k
views
Weights argument in glmer() when predicting proportion data: why is it needed when all weights are around the same?
What do the weights argument in glmer refer to? I used sample sizes as weights with ...
7
votes
0
answers
3k
views
Meaning of the weight argument in glmer and lmer
I have been looking into how to use the weight argument of glmer/lmer to represent "frequency" weights. I was ...
6
votes
2
answers
2k
views
Does offset always have to be on log scale with NB GLMM?
I'm using a negative binomial GLMM with R package lme4 to detect differences in time mothers spend feeding before and after birth (inf_cat).
...
6
votes
1
answer
12k
views
GLMER not converging
Here is a sample of 20 rows from some data I'm working with (everything below is consistent with the full dataset):
...
6
votes
2
answers
1k
views
Confused about meaning of subject-specific coefficients in a binomial generalised mixed-effects model
In *A Comparison of Cluster-Specific and Population-Averaged Approaches for Analyzing Correlated Binary Data*, Neuhas, Kalbfleisch, and Hauck state:
"With the cluster-specific approach, the ...
6
votes
1
answer
2k
views
Interpretation of binomial GLM (glmer) with interaction and results description
I would like to confirm if I am analysing the results of my model correctly and get some advise if I am missing something!
I conducted the following model to analyse factors that describe the feeding ...
6
votes
2
answers
5k
views
How to set up an intercept-only mixed logistic regression in order to test for difference from 50% chance level?
In my experiment, subjects repeatedly had to make a binary choice between A and B, and I want to test if subjects (as a group) differed from 50% chance in preferring A over B. Is there a way to test ...
6
votes
1
answer
4k
views
Covariance structures in glmmTMB for temporal autocorrelation
I'm running a zero-inflated, mixed-effects negative binomial model with the glmmTMB package in R.
My current format:
...
6
votes
1
answer
104
views
Strange result with GLMM (binomial)
I'm analyzing some data, using GLMM and obtain very strange results. The data is of student passing a test, each group of students belong to a different school. So I analyzed the data using ...
6
votes
1
answer
4k
views
Which method to use when calculating the confidence interval of GLMM Gamma Regression with the lme4 package in R
I am fitting a GLMM with family gamma using the lme4 package in R. Below is a code example to simulate the gamma GLMM fitting.
...
6
votes
0
answers
229
views
What can Ido if I get patterns in residuals vs predicted values using `lme4::glmer()` with a GAMMA distribution?
I want to model a response variable (y) as a function of two explanatory variables (x and z)....
5
votes
2
answers
573
views
GLMM for count data using square root link in lme4
I have data from a field survey. The objective of the study is to relate number of seedling (respond variable, count data), landform (exploratory variable, categorical variable with 3 levels) and ...