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.

Overview

Mixed models are linear models that include both fixed effects and random effects*. They are used to model longitudinal or nested data; such data do not have independent errors and mixed models can account for the arising correlations. Mixed models are also known as multilevel or hierarchical linear models.

A classic example is the estimation of test scores of students: if test scores are correlated within classes, schools, districts, etc., mixed models allow the modeler to simultaneously estimate the differences between individual students and between the groups to which they belong (with the possibility of including covariates at all levels).

In a mixed model, study units are thought of as sampled from a population; the fixed effects are estimates of the population average effect, whereas the random effects are specific to the study units. In matrix form, a mixed effects model might be: $$ \bf Y=X\boldsymbol\beta + Zb + \boldsymbol\varepsilon $$ where $\bf X$ is the design matrix, $\boldsymbol\beta$ is a vector of the population average effects, $\bf Z$ is a subset of the columns of $\bf X$, $\bf b$ is a vector of the unit specific deviations from the population effects, and $\boldsymbol \varepsilon$ is a vector of random errors.

* Note that here we follow terminology used in statistics, social sciences, and biostatistics; similar terminology ("fixed effects", "random effects") is also used in econometrics, but the meaning is different.

References

StatsExchangers often recommend the following resources for learning more about mixed models:

Software packages

Mixed models are available in the following statistical packages:

  • lme4 and nlme for R
  • PROC MIXED and GLIMMIX for SAS
  • MLwiN
  • xtreg, xtmixed, xtlogit, xtmelogit, xtmepoisson, and other xt* commands; user-contributed package GLLAMM for Stata
  • Mplus
  • HLM
6418 questions
20
votes
3 answers

What would be an illustrative picture for linear mixed models?

Say that you are in the library of your department of statistics, and that you come across a book with the following picture in the front page. You will probably think that this is a book about linear regression things. What would be the picture…
ocram
  • 21,851
16
votes
3 answers

Linear Mixed Effects Models

I have commonly heard that LME models are more sound in the analysis of accuracy data (i.e., in psychology experiments), in that they can work with binomial and other non-normal distributions that traditional approaches (e.g., ANOVA) can't. What is…
Mike Wong
  • 437
  • 1
  • 5
  • 10
14
votes
2 answers

Why is it difficult to incorporate uncertainty in random effects when making predictions from mixed models?

There are several threads on R-sig-ME about obtaining confidence intervals for predictions using lme4 and nlme in R. For example here and here in 2010, including some commentary by Dougals Bates, one of the authors of both packages. I hesitate to…
LeelaSella
  • 2,030
13
votes
1 answer

Baseline adjustment in mixed models

I am doing mixed model analysis to evaluate (Y=) fruit intake (continuous variable) between two groups (intervention versus control) over time (baseline, year 1, year 2, year 5, year 7 and year 15). My model look like this: Y = group + time +…
11
votes
2 answers

Random Intercept model vs. GEE

Consider a random intercept linear model. This is equivalent to GEE linear regression with an exchangeable working correlation matrix. Suppose the predictors are $x_1, x_2,$ and $x_3$ and the coefficients for these predictors are $\beta_1$,…
guy
  • 153
11
votes
2 answers

Getting P value with mixed effect with lme4 package

I have problem with getting p value from my mixed model, library(lme4) DWR<-lmer(DWRm2~Growth.stage+Se.application+Growth.stage:Se.application+(1|Block),data=Sub1) summary(DWR) before I used this model and I got p value with summary my model but…
9
votes
1 answer

Can we really assign random slopes to between-subject effects in a mixed effects model?

This question is inspired by the comments to one of my answers on this forum: Should all adjustments be random effects in a mixed linear effect?. In my answer, I stated something akin to the following: In a mixed effects model, only within-subject…
Isabella Ghement
  • 20,314
  • 2
  • 34
  • 58
8
votes
2 answers

Mixed model in simple english

Can someone please explain the intuition behind mixed models in a nutshell? Whenever I read explanations, I get overwhelmed by notation and mathematical jargon. Can someone give me a simple example or motivation to help me understand the concept in…
phil12
  • 1,371
8
votes
1 answer

warning: Some predictor variables are on very different scales: consider rescaling

I am using multilevel modeling in lme4 package in R. With the warning of rescaling variables, how can I find out WHICH variables need rescaling? All variables are centered. Dummy variables are coded as -1 and 1, the variable age has range of -34 and…
7
votes
2 answers

Extracting fixed effects table output from lme object

I am trying to fit a model which is similar to the fm2orth.lm<-lme(distance~age,data=OrthoFem, random=~1|Subject) and did summary(fm2Orth.lm) my output had these parts Aic/BIC Random Effects Fixed Effects table Correlation. My question…
Steve
  • 71
7
votes
2 answers

Interpreting the random effect in a mixed-effect model

I am looking at several dependant variables for which I created LMMs of the following kind: DV ~ Group + (1|Subject) + (1|Time) Now I am struggling with how to interpret the output concerning the random effects, e.g. for DV1: Random effects: …
user45065
7
votes
1 answer

How do I enter a continuous variable as a random effect in a linear mixed effects model?

I collected data on the growth of juvenile fish from 4 different types of crosses using multiple distinct family blocks and I am trying to see if cross type has an effect on growth using linear mixed effects models. I have one fixed factor (Length),…
6
votes
1 answer

Linear Mixed Effect Model - random intercept and slope? Identifiability problems

I have a question regarding model building for a large dataset including about 5000 Subjects. I want to fit a LMEM including multiple variables and I have repeated measurements in time. But for some of the subjects (around 1200, means <25%) I only…
Kathrin
  • 195
  • 1
  • 9
5
votes
1 answer

Interpretation of fixed effects in a mixed model

I have read many times that the interpretation of fixed effects estimates differs in a mixed model, compared to a model without random effects. For example this answer from Dimitris Rizopoulos: Interpretation of fixed effect coefficients from GLMs…
underflow
  • 306
5
votes
2 answers

Mixed effect model, number of random effects and fixed effects

I have a dataset where abundance is being changed by group (2 categories, fixed effect) and I want to account for random effect subject (15 subjects). Basically, each of the 15 subjects went through both groups such that the total number of samples…
Sos
  • 411
1
2 3
10 11