If you use mixed-effects models (aka multilevel models, hierarchical models), I am sure that at some point you asked yourself the following question at least once: Should I include variable X as a fixed or as a random effect?

To answer this question we need to ask first: what is a random effect?

Regrettably, there is no straightforward answer (disappointed, uh?).

The main reason is that, in fact, there are many possible (and most times mutually exclusive) definitions of what a random (vs fixed) effect is.

In the following summary—which is heavily based on Gelman’s post Why I don’t use the term “fixed and random effects” (and related journal article)—I’d like to offer an overview of five main definitions of “random effect” and some final thoughts.

Five definitions of “random effect”

In his post, Gelman says that there are at least five possible ways of defining random effects (with others being subsumable under those five). To illustrate these definitions and make them more relatable to phoneticians and phonologists alike, I will make use of a fictitious study of f0 (fundamental frequency) as a correlate of emotional arousal (\(\eta\)).

Let’s assume that we are interested in testing the (made-up) hypothesis that emotional arousal affects the speaker’s f0. We can test this hypothesis using the following model:

\[ f0_{ij} = \alpha + \alpha_j + \beta \times \eta_i \]

where

  • \(f0_{ij}\) is the outcome variable,
  • \(\alpha\) is the intercept,
  • \(\alpha_j\) is the individual speakers’ intercept coefficient,
  • \(\beta\) is the slope,
  • and \(\eta_i\) is emotional arousal status (0 = non-aroused, 1 = aroused).

The corresponding model in R:

f0 ~ emo_arousal + (1 | speaker)

This is just a model with a fixed effect and a by-speaker random intercept. The inclusion of speaker as a random effect is nothing exceptional, but what is a random effect?

As hinted at above, there is no one answer.

The following sections show how “speaker” can be interpreted as a random effect depending on which of the five definitions one picks.

(1) Constant vs varying coefficients

Kreft, Kreft, and Leeuw (1998) distinguish between fixed and random regression coefficients. Fixed coefficients are constant across individuals, while random coefficients vary.

In the f0 study, the slope \(\beta\) is fixed and \(\alpha_j\) is random because it depends on which speaker the data is from.

(2) Researcher’s interest

Searle, Casella, and McCulloch (2009, sec. 1.4) discuss effects in terms of the researcher’s interest. Effects are considered fixed if the research question/hypothesis being tested covers those effects, or random if the interest lies in the underlying population rather than on the individual effects.

In this sense, the effect of emotional arousal on f0 is the main focus of interest since we are testing the hypothesis that the former affects the latter, while the average f0 of each speaker (\(\alpha_j\)) is not relevant.

(3) Sampling

When a sample exhausts the population, the corresponding variable is fixed; when the sample is a small (i.e., negligible) part of the population the corresponding variable is random.

Green and Tukey (1960)

In our example study, the observed levels of emotional arousal (non-aroused vs aroused) exhausts the “population” of emotional arousal states, while the set of speakers is just a sample from the whole population of speakers.

(4) Random events

If an effect is assumed to be a realized value of a random variable, it is called a random effect.

LaMotte (1983)

A random variable is a variable generated by a random event.

In the f0 study, the speakers that participated in the study are the outcome of random events, while we assume that the relation between f0 and arousal is governed by a specific mathematical relationship.

(5) Shrinkage

The last definition of fixed vs random effects is based on the method employed to estimate them. Fixed effects are estimated using maximum likelihood, while random effects are estimated with partial pooling. Partial pooling means that the estimation of the random effects influence the estimation of the fixed effects and vice versa. This definition is standard in the multilevel modelling literature (Snijders and Bosker 2011, sec. 4.2) and in econometrics.

A consequence of partial pooling is the so-called “shrinkage.” Shrinkage refers to the “regression to the mean,” by which the estimated effects are attracted towards the overall mean (i.e. the intercept).

So in the f0 study, the by-speaker random intercepts “shrink” towards the estimated fixed intercept. In sum, fixed effects are effects without shrinkage while random effects are effects with shrinkage.

Thus, under this definition, whether one chooses to model an effect with or without shrinkage has to do with the underlying process model one expects to have generated the observed data. If the expected process of a variable entails shrinkage, then it would make sense to enter such variable as a random effect.

Some final thoughts

I agree with Gelman’s statement that the terms “fixed” and “random” could (and perhaps should) be avoided altogether.

Within the Bayesian framework, for example, it is becoming common to use the terms “population-level” and “group-level” effects to indicate, respectively, effects that are generated by a population-wide process vs effects that are generated by the modulation of such generative process within groups that make up the population.

As in definition (5) above, group-level effects are estimated with partial pooling (for a nice detailed explanation of partial pooling that includes robots cuing for coffee and tadpoles, see McElreath 2015, Ch 12).

To conclude, whether you include a variable as a fixed or random effect will depend on (a) which definition of random effect you (explicitly or implicitly) choose, and (b) what underlying generative process you envision to be at play.

Reference

Green, Bert F., and John W. Tukey. 1960. “Complex Analyses of Variance: General Problems.” Psychometrika 25 (2): 127–52. https://doi.org/10.1007/BF02288577.
Kreft, Ita G. G., Ita Kreft, and Jan de Leeuw. 1998. Introducing Multilevel Modeling. Sage.
LaMotte, L. R. 1983. “Fixed-, Random-, and Mixed-Effects Models.” In Encyclopedia of Statistical Sciences, edited by N. L. Johnson S. Kotz and C. B. Read, 3:137–41. New York: Wiley.
McElreath, Richard. 2015. Statistical Rethinking: A Bayesian Course with Examples in r and Stan. Boca Raton, FL: CRC Press.
Searle, Shayle R., George Casella, and Charles E. McCulloch. 2009. Variance Components. John Wiley & Sons.
Snijders, Tom A. B., and Roel J. Bosker. 2011. Multilevel Analysis: An Introduction to Basic and Advanced Multilevel Modeling. Sage.