Fixed, mixed, and random effects models represent different approaches to handling hierarchical or grouped data structures, each making distinct assumptions about how parameters vary across groups.
Fixed Effects Models
In fixed effects models, each group (like individual subjects, companies, or geographic regions) gets its own intercept parameter. If you have data from 100 companies over time, you'd estimate 100 separate intercept terms. The design matrix includes dummy variables for each group, creating a block structure where each observation is linked to exactly one group indicator. These group-specific parameters are treated as fixed quantities to be estimated directly.
The key property is that the design matrix becomes very wide - you need as many group dummy variables as you have groups. This approach works well when you care about the specific groups in your dataset and have sufficient observations per group, but it doesn't generalize to new, unseen groups.
Random Effects Models
Random effects treat group-specific deviations as draws from a probability distribution, typically normal with mean zero and some variance σ². Instead of estimating separate parameters for each group, you estimate the variance of the random distribution. The design matrix here is more compact - you don't need dummy variables for every group.
From a machine learning perspective, this is like assuming each group's effect is a latent variable sampled from a prior distribution. The model learns the parameters of this distribution rather than individual group effects. This approach generalizes better to new groups and is more parameter-efficient, but assumes exchangeability among groups.
Mixed Effects Models
Mixed effects combine both approaches, including some fixed effects (for variables where you want group-specific estimates) and some random effects (for variables where you model group variation as random). The design matrix has both the wide dummy variable structure for fixed effects and the compact structure for random effects components.
Machine Learning Perspective
These models are closely related to modern ML concepts. Random effects are similar to learned embeddings for categorical variables in neural networks, where each group gets a learned vector representation. Mixed effects models resemble hierarchical Bayesian models where some parameters have informative priors (fixed effects) while others are drawn from learned distributions (random effects).
The choice between approaches involves a bias-variance tradeoff: fixed effects have lower bias for the specific groups in your data but higher variance and no generalization, while random effects introduce some bias but reduce variance and enable generalization to new groups.