Questions tagged [mixed-model]

Mixed (aka multilevel or hierarchical) models are linear models that include both fixed effects and random effects. They are used to model longitudinal or nested data.

Filter by
Sorted by
Tagged with
269
votes
9answers
491k views

What is the difference between fixed effect, random effect and mixed effect models?

In simple terms, how would you explain (perhaps with simple examples) the difference between fixed effect, random effect and mixed effect models?
160
votes
3answers
78k views

R's lmer cheat sheet

There's a lot of discussion going on on this forum about the proper way to specify various hierarchical models using lmer. I thought it would be great to have all ...
88
votes
1answer
40k views

Crossed vs nested random effects: how do they differ and how are they specified correctly in lme4?

Here is how I have understood nested vs. crossed random effects: Nested random effects occur when a lower level factor appears only within a particular level of an upper level factor. For ...
88
votes
2answers
49k views

How scared should we be about convergence warnings in lme4

If we a re fitting a glmer we may get a warning that tells us the model is finding a hard time to converge...e.g. ...
85
votes
4answers
44k views

How to choose nlme or lme4 R library for mixed effects models?

I have fit a few mixed effects models (particularly longitudinal models) using lme4 in R but would like to really master the ...
73
votes
3answers
62k views

What is “restricted maximum likelihood” and when should it be used?

I have read in the abstract of this paper that: "The maximum likelihood (ML) procedure of Hartley aud Rao is modified by adapting a transformation from Patterson and Thompson which partitions the ...
64
votes
5answers
4k views

Unified view on shrinkage: what is the relation (if any) between Stein's paradox, ridge regression, and random effects in mixed models?

Consider the following three phenomena. Stein's paradox: given some data from multivariate normal distribution in $\mathbb R^n, \: n\ge 3$, sample mean is not a very good estimator of the true mean. ...
63
votes
3answers
66k views

When to use generalized estimating equations vs. mixed effects models?

I have been quite happily using mixed effects models for a while now with longitudinal data. I wish I could fit AR relationships in lmer (I think I'm right that I can't do this?) but I don't think it'...
56
votes
9answers
119k views

How to obtain the p-value (check significance) of an effect in a lme4 mixed model?

I use lme4 in R to fit the mixed model lmer(value~status+(1|experiment))) where value is continuous, status and experiment are factors, and I get ...
55
votes
3answers
72k views

Questions about how random effects are specified in lmer

I recently measured how the meaning of a new word is acquired over repeated exposures (practice: day 1 to day 10) by measuring ERPs (EEGs) when the word was viewed in different contexts. I also ...
55
votes
5answers
6k views

How exactly does a “random effects model” in econometrics relate to mixed models outside of econometrics?

I used to think that "random effects model" in econometrics corresponds to a "mixed model with random intercept" outside of econometrics, but now I am not sure. Does it? Econometrics uses terms like "...
41
votes
2answers
70k views

Using lmer for repeated-measures linear mixed-effect model

EDIT 2: I originally thought I needed to run a two-factor ANOVA with repeated measures on one factor, but I now think a linear mixed-effect model will work better for my data. I think I nearly know ...
38
votes
5answers
73k views

Negative values for AICc (corrected Akaike Information Criterion)

I have calculated AIC and AICc to compare two general linear mixed models; The AICs are positive with model 1 having a lower AIC than model 2. However, the values for AICc are both negative (model 1 ...
37
votes
2answers
23k views

Prediction interval for lmer() mixed effects model in R

I want to get a prediction interval around a prediction from a lmer() model. I have found some discussion about this: http://rstudio-pubs-static.s3.amazonaws.com/...
36
votes
2answers
24k views

How trustworthy are the confidence intervals for lmer objects through effects package?

Effects package provides a very fast and convenient way for plotting linear mixed effect model results obtained through lme4 ...
36
votes
8answers
20k views

Under what conditions should one use multilevel/hierarchical analysis?

Under which conditions should someone consider using multilevel/hierarchical analysis as opposed to more basic/traditional analyses (e.g., ANOVA, OLS regression, etc.)? Are there any situations in ...
35
votes
2answers
26k views

What is compound symmetry in plain english?

I recently realized that a mixed-model with only subject as a random factor and the other factors as fixed factors is equivalent to an ANOVA when setting the correlational structure of the mixed model ...
35
votes
1answer
13k views

What are easy to interpret, goodness of fit measures for linear mixed effects models?

I am currently using the R package lme4. I am using a linear mixed effects models with random effects: ...
34
votes
3answers
45k views

Difference between generalized linear models & generalized linear mixed models

I am wondering what the differences are between mixed and unmixed GLMs. For instance, in SPSS the drop down menu allows users to fit either: ...
34
votes
2answers
49k views

Mixed Effects Model with Nesting

I have data collected from an experiment organized as follows: Two sites, each with 30 trees. 15 are treated, 15 are control at each site. From each tree, we sample three pieces of the stem, and ...
34
votes
3answers
44k 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 ...
32
votes
1answer
2k views

Variance on the sum of predicted values from a mixed effect model on a timeseries

I have a mixed effect model (in fact a generalized additive mixed model) that gives me predictions for a timeseries. To counter the autocorrelation, I use a corCAR1 model, given the fact I have ...
31
votes
4answers
15k views

How do I fit a multilevel model for over-dispersed poisson outcomes?

I want to fit a multilevel GLMM with a Poisson distribution (with over-dispersion) using R. At the moment I am using lme4 but I noticed that recently the ...
31
votes
1answer
72k views

Negative values for AIC in General Mixed Model [duplicate]

I'm trying to select the best model by the AIC in the General Mixed Model test. The best model is the model with the lowest AIC, but all my AIC's are negative! So is the biggest negative AIC the ...
31
votes
1answer
33k views

Multiple comparisons on a mixed effects model

I am trying to analyse some data using a mixed effect model. The data I collected represent the weight of some young animals of different genotype over time. I am using the approach proposed here: ...
30
votes
1answer
16k views

What does the anova() command do with a lmer model object?

Hopefully this is a question that someone here can answer for me on the nature of decomposing sums of squares from a mixed-effects model fit with lmer (from the ...
30
votes
2answers
19k views

lme and lmer comparison

I was wondering if anyone could enlighten me on the current differences between these two functions. I found the following question: How to choose nlme or lme4 R library for mixed effects models?, but ...
28
votes
3answers
38k views

How to get an “overall” p-value and effect size for a categorical factor in a mixed model (lme4)?

I would like to get a p-value and an effect size of an independent categorical variable (with several levels) -- that is "overall" and not for each level separately, as is the normal output from ...
28
votes
1answer
34k views

How to interpret variance and correlation of random effects in a mixed-effects model?

I hope you all don't mind this question, but I need help interpreting output for a linear mixed effects model output I've been trying to learn to do in R. I am new to longitudinal data analysis and ...
28
votes
1answer
3k views

Computing repeatability of effects from an lmer model

I just came across this paper, which describes how to compute the repeatability (a.k.a. reliability, a.k.a. intraclass correlation) of a measurement via mixed effects modelling. The R code would be: <...
27
votes
5answers
17k views

Example reports for mixed-model analysis using lmer in biology, psychology and medicine?

As the general consensus seems to be to use mixed-models via lmer() in R instead of classical ANOVA (for the often cited reasons, like unbalanced designs, crossed ...
27
votes
2answers
2k views

In a multi-level model, what are the practical implications of estimating versus not-estimating random effect correlation parameters?

In a multi-level model, what are the practical and interpretation-related implications of estimating versus not-estimating random effect correlation parameters? The practical reason for asking this ...
26
votes
7answers
18k views

What is the minimum recommended number of groups for a random effects factor?

I'm using a mixed model in R (lme4) to analyze some repeated measures data. I have a response variable (fiber content of feces) ...
26
votes
1answer
20k views

What is the difference between generalized estimating equations and GLMM?

I'm running a GEE on 3-level unbalanced data, using a logit link. How does this differ (in terms of the conclusions I can draw and the meaning of the coefficients) from a GLM with mixed effects (GLMM)...
26
votes
3answers
24k views

How do I interpret the 'correlations of fixed effects' in my glmer output?

I have the following output: ...
26
votes
1answer
34k views

predict() Function for lmer Mixed Effects Models

The problem: I have read in other posts that predict is not available for mixed effects lmer {lme4} models in [R]. I tried ...
25
votes
4answers
67k views

Checking assumptions lmer/lme mixed models in R

I ran a repeated design whereby I tested 30 males and 30 females across three different tasks. I want to understand how the behaviour of males and females is different and how that depends on the task....
25
votes
5answers
4k views

What is the mathematical difference between random- and fixed-effects?

I have found a lot on the internet regarding the interpretation of random- and fixed-effects. However I could not get a source pinning down the following: What is the mathematical difference between ...
25
votes
2answers
18k views

Have I correctly specified my model in lmer?

I have scoured lots of help sites and am still confused about how to specify more complicated nested terms in a mixed model as well. I am also confused as the use of ...
25
votes
5answers
93k views

How to test and avoid multicollinearity in mixed linear model?

I am currently running some mixed effect linear models. I am using the package "lme4" in R. My models take the form: ...
25
votes
2answers
10k views

Satterthwaite vs. Kenward-Roger approximations for the degrees of freedom in mixed models

The lmerTest package provides an anova() function for linear mixed models with optionally Satterthwaite's (default) or Kenward-...
25
votes
1answer
588 views

When are zero-correlation mixed models theoretically sound?

The block quotation below, from leaders in the field of mixed effect modeling, claims that coordinate shifts in models with zero correlation between random effects ('ZCP' models) changes model ...
24
votes
2answers
17k views

Why do lme and aov return different results for repeated measures ANOVA in R?

I am trying to move from using the ez package to lme for repeated measures ANOVA (as I hope I will be able to use custom ...
24
votes
2answers
6k views

Are mixed models useful as predictive models?

I am a bit confused about advantages of mixed models in regard to predictive modelling. Since predictive models are usually meant to predict values of previously unknown observations then it seems ...
24
votes
5answers
3k views

What is the upside of treating a factor as random in a mixed model?

I have a problem embracing the benefits of labeling a model factor as random for a few reasons. To me it appears like in almost all cases the optimal solution is to treat all of the factors as fixed. ...
23
votes
2answers
23k views

Sample size calculation for mixed models

I am wondering if there are any methods for calculating sample size in mixed models? I'm using lmer in R to fit the models (I have random slopes and intercepts).
23
votes
2answers
2k views

Does it make sense for a fixed effect to be nested within a random one, or how to code repeated measures in R (aov and lmer)?

I have been looking through this overview of lm/lmer R formulas by @conjugateprior and got confused by the following entry: Now assume A is random, but B is fixed and B is nested within A. ...
22
votes
2answers
9k views

How should mixed effects models be compared and or validated?

How are (linear) mixed effects models normally compared against each other? I know likelihood ratio tests can be used, but this doesn't work if one model is not a 'subset' of the other correct? Is ...
21
votes
2answers
15k 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; ...
21
votes
2answers
18k 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 ...