We’re rewarding the question askers & reputations are being recalculated! Read more.

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
271
votes
9answers
500k 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?
161
votes
3answers
79k 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 ...
89
votes
1answer
41k 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 ...
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: ...
63
votes
3answers
67k 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'...
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 ...
9
votes
1answer
3k views

Interpretation of Fixed Effects from Mixed Effect Logistic Regression

I am confused by statements at a UCLA webpage about mixed effects logistic regression. They show a table of fixed effects coefficients from fitting such a model and the first paragraph belows seems to ...
19
votes
3answers
14k views

Comparing non nested models with AIC

Say we have to GLMMs mod1 <- glmer(y ~ x + A + (1|g), data = dat) mod2 <- glmer(y ~ x + B + (1|g), data = dat) These models are not nested in the usual ...
56
votes
9answers
122k 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 ...
20
votes
4answers
17k views

How does a Poisson distribution work when modeling continuous data and does it result in information loss?

A co-worker is analyzing some biological data for her dissertation with some nasty Heteroscedasticity (figure below). She's analyzing it with a mixed model but is still having trouble with the ...
9
votes
3answers
4k views

What to do with random effects correlation that equals 1 or -1?

Not so uncommon occurrence when dealing with complex maximal mixed models (estimating all possible random effects for given data and model) is perfect (+1 or -1) or nearly perfect correlation among ...
73
votes
3answers
63k 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 ...
20
votes
1answer
12k views

Why do the estimated values from a Best Linear Unbiased Predictor (BLUP) differ from a Best Linear Unbiased Estimator (BLUE)?

I understand that the difference between them is related to whether the grouping variable in the model is estimated as a fixed or random effect, but it's not clear to me why they are not the same (if ...
26
votes
1answer
21k 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)...
21
votes
2answers
16k 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; ...
34
votes
2answers
50k 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 ...
26
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 ...
26
votes
7answers
19k 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) ...
15
votes
4answers
7k views

Fixed effect vs random effect when all possibilities are included in a mixed effects model

In a mixed effects model the recommendation is to use a fixed effect to estimate a parameter if all possible levels are included (e.g., both males and females). It is further recommended to use a ...
85
votes
4answers
45k 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 ...
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 ...
18
votes
5answers
9k views

Beta regression of proportion data including 1 and 0

I am trying to produce a model for which I have a response variable which is a proportion between 0 and 1, this includes quite a few 0s and 1s but also many values in between. I am thinking about ...
65
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. ...
15
votes
1answer
7k 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 ...
11
votes
2answers
4k views

What is the lme4::lmer equivalent of a three-way repeated measures ANOVA?

My question is based on this response which showed which lme4::lmer model corresponds to a two-way repeated measures ANOVA: ...
14
votes
3answers
3k views

Why does one have to use REML (instead of ML) for choosing among nested var-covar models?

Various descriptions on model selection on random effects of Linear Mixed Models instruct to use REML. I know difference between REML and ML at some level, but I don't understand why REML should be ...
55
votes
3answers
73k 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 ...
56
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 "...
19
votes
2answers
29k views

Repeated measures ANOVA with lme/lmer in R for two within-subject factors

I'm trying to use lme from the nlme package to replicate results from aov for repeated ...
17
votes
2answers
30k views

REML or ML to compare two mixed effects models with differing fixed effects, but with the same random effect?

Background: Note: My dataset and r-code are included below text I wish to use AIC to compare two mixed effects models generated using the lme4 package in R. Each model has one fixed effect and one ...
23
votes
2answers
3k 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. ...
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 ...
26
votes
5answers
5k 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 ...
3
votes
2answers
33k views

Getting P value with mixed effect with lme4 package [duplicate]

I have problem with getting p value from my mixed model, library(lme4) ...
12
votes
2answers
8k views

Calculating $R^2$ in mixed models using Nakagawa & Schielzeth's (2013) R2glmm method

I have been reading about calculating $R^2$ values in mixed models and after reading the R-sig FAQ, other posts on this forum (I would link a few but I don't have enough reputation) and several other ...
10
votes
1answer
8k views

Comparing mixed-effects and fixed-effects models (testing significance of random effects)

Given three variables, y and x, which are positive continuous, and z, which is categorical, ...
21
votes
0answers
13k views

Formula symbols for mixed model using lme4 [duplicate]

I often confuse symbols :, |, / and * in the ...
41
votes
2answers
71k 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 ...
28
votes
3answers
39k 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 ...
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 ...
26
votes
3answers
25k views

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

I have the following output: ...
11
votes
5answers
12k views

When to use mixed effect model?

Linear Mixed Effects Models are Extensions of Linear Regression models for data that are collected and summarized in groups. The key advantages is the coefficients can vary with respect to one or more ...
10
votes
1answer
7k views

OLS with clustered standard errors vs. multilevel modeling when the main interest is at the individual level [duplicate]

Possible Duplicate: Under what conditions should one use multilevel/hierarchical analysis? I have been reading various papers dealing with multilevel analysis, and to be honest, I am still ...
17
votes
2answers
8k 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 ...
11
votes
2answers
28k views

Dealing with singular fit in mixed models

Let's say we have a model ...
6
votes
2answers
1k views

Equivalent to Welch's t-test in GLS framework

How can Welch's t-test be expressed as a generalized least squares model? A standard independent samples t-test (where it is assumed that the samples being compared are drawn from populations with ...
6
votes
2answers
2k views

How can I test for differences in variation between groups in a mixed model (lme4)?

I would like to test for differences in variation, not in means, between two sites. By looking at a boxplot of my data I see that bird song in one site look much more variable in length than in ...
27
votes
5answers
18k 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 ...
23
votes
2answers
24k 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).
16
votes
1answer
11k views

Understanding the variance of random effects in lmer() models

I'm having trouble understanding the output of my lmer() model. It is a simple model of an outcome variable (Support) with varying State intercepts / State random ...