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.
950
questions
429
votes
9
answers
872k
views
What is the difference between fixed effect, random effect in mixed effect models?
In simple terms, how would you explain (perhaps with simple examples) the difference between fixed effect, random effect in mixed effect models?
192
votes
1
answer
147k
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 ...
228
votes
3
answers
184k
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 ...
46
votes
7
answers
46k
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) ...
42
votes
3
answers
66k
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:
...
97
votes
11
answers
264k
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
...
23
votes
3
answers
25k
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 ...
15
votes
1
answer
14k
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 ...
87
votes
3
answers
99k
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'...
63
votes
2
answers
67k
views
What is a difference between random effects-, fixed effects- and marginal model?
I am trying to expand my knowledge of statistics. I come from a physical sciences background with a "recipe based" approach to statistical testing, where we say is it continuous, is it normally ...
96
votes
3
answers
108k
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 ...
26
votes
2
answers
23k
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 ...
19
votes
5
answers
18k
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 ...
29
votes
6
answers
21k
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 ...
34
votes
2
answers
39k
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;
...
48
votes
2
answers
76k
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 ...
35
votes
6
answers
24k
views
How can I include random effects (or repeated measures) into a randomForest
I'm not even sure that the question makes much sense, but I think I saw a couple of titles of papers where they proposed random forest with random effects. Is this possible in R?
26
votes
1
answer
20k
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 ...
24
votes
2
answers
25k
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 ...
21
votes
1
answer
18k
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
3
answers
14k
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 ...
99
votes
4
answers
63k
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 ...
69
votes
5
answers
12k
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 "...
21
votes
4
answers
22k
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 ...
12
votes
1
answer
2k
views
How to simplify a singular random structure when reported correlations are not near +1/-1
I have read in several answers to questions on this site that the best way to choose the random structure for a mixed effects model is by using theoretical knowledge. On the other hand I have also ...
38
votes
1
answer
32k
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)...
34
votes
2
answers
52k
views
REML or ML to compare two mixed effects models with differing fixed effects, but with the same random effect?
Background: Note: My data set 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 ...
29
votes
2
answers
25k
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 ...
16
votes
5
answers
25k
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 ...
13
votes
2
answers
7k
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:
...
31
votes
5
answers
8k
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
2
answers
9k
views
Minimum sample size per cluster in a random effect model
Is there a rational for the number of observations per cluster in a random effect model? I have a sample size of 1,500 with 700 clusters modeled as exchangeable random effect. I have the option to ...
81
votes
5
answers
6k
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. ...
21
votes
2
answers
14k
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 ...
18
votes
3
answers
8k
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 ...
1
vote
2
answers
511
views
How to account for participants in a study design?
I have a conceptual problem.
I want to find out if stress during the day leads to (stronger) teeth grinding (bruxism) at night. I have a number of participants. They will fill in a self-report ...
69
votes
3
answers
140k
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 ...
41
votes
8
answers
25k
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 ...
33
votes
3
answers
52k
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
3
answers
37k
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).
27
votes
2
answers
5k
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.
...
24
votes
2
answers
38k
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 ...
18
votes
2
answers
2k
views
Intuition about parameter estimation in mixed models (variance parameters vs. conditional modes)
I have read many times that random effects (BLUPs/conditional modes for, say, subjects) are not parameters of a linear mixed effects model but instead can be derived from the estimated variance/...
42
votes
3
answers
38k
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 ...
23
votes
2
answers
18k
views
Paired t-test as a special case of linear mixed-effect modeling
We know that a paired t-test is just a special case of one-way repeated-measures (or within-subject) ANOVA as well as linear mixed-effect model, which can be demonstrated with lme() function the nlme ...
15
votes
1
answer
12k
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 ...
9
votes
2
answers
7k
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 ...
56
votes
2
answers
109k
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 ...
36
votes
1
answer
76k
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 ...
19
votes
2
answers
14k
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 ...