Mixed model should not be confused with mixture model.
A mixed model, mixed-effects model or mixed error-component model is a statistical model containing both fixed effects and random effects.[1] [2] These models are useful in a wide variety of disciplines in the physical, biological and social sciences.They are particularly useful in settings where repeated measurements are made on the same statistical units (see also longitudinal study), or where measurements are made on clusters of related statistical units. Mixed models are often preferred over traditional analysis of variance regression models because they don't rely on the independent observations assumption. Further, they have their flexibility in dealing with missing values and uneven spacing of repeated measurements.[3] The Mixed model analysis allows measurements to be explicitly modeled in a wider variety of correlation and variance-covariance avoiding biased estimations structures.
This page will discuss mainly linear mixed-effects models rather than generalized linear mixed models or nonlinear mixed-effects models.[4]
Linear mixed models (LMMs) are statistical models that incorporate fixed and random effects to accurately represent non-independent data structures. LMM is an alternative to analysis of variance. Often, ANOVA assumes the independence of observations within each group, however, this assumption may not hold in non-independent data, such as multilevel/hierarchical, longitudinal, or correlated datasets.
Non-independent sets are ones in which the variability between outcomes is due to correlations within groups or between groups. Mixed models properly account for nest structures/hierarchical data structures where observations are influenced by their nested associations. For example, when studying education methods involving multiple schools, there are multiple levels of variables to consider. The individual level/lower level comprises individual students or teachers within the school. The observations obtained from this student/teacher is nested within their school. For example, Student A is a unit within the School A. The next higher level is the school. At the higher level, the school contains multiple individual students and teachers. The school level influences the observations obtained from the students and teachers. For Example, School A and School B are the higher levels each with its set of Student A and Student B respectively. This represents a hierarchical data scheme. A solution to modeling hierarchical data is using linear mixed models.LMMs allow us to understand the important effects between and within levels while incorporating the corrections for standard errors for non-independence embedded in the data structure.[5]
Fixed effects encapsulate the tendencies/trends that are consistent at the levels of primary interest. These effects are considered fixed because they are non-random and assumed to be constant for the population being studied. For example, when studying education a fixed effect could represent overall school level effects that are consistent across all schools.
While the hierarchy of the data set is typically obvious, the specific fixed effects that affect the average responses for all subjects must be specified. Some fixed effect coefficients are sufficient without corresponding random effects where as other fixed coefficients only represent an average where the individual units are random. These may be determined by incorporating random intercepts and slopes.[6] [7] [8]
In most situations, several related models are considered and the model that best represents a universal model is adopted.
A key component of the mixed model is the incorporation of random effects with the fixed effect. Fixed effects are often fitted to represent the underlying model. In Linear mixed models, the true regression of the population is linear, β. The fixed data is fitted at the highest level. Random effects introduce statistical variability at different levels of the data hierarchy. These account for the unmeasured sources of variance that affect certain groups in the data. For example, the differences between student 1 and student 2 in the same class, or the differences between class 1 and class 2 in the same school.
Ronald Fisher introduced random effects models to study the correlations of trait values between relatives.[9] In the 1950s, Charles Roy Hendersonprovided best linear unbiased estimates of fixed effects and best linear unbiased predictions of random effects.[10] [11] [12] [13] Subsequently, mixed modeling has become a major area of statistical research, including work on computation of maximum likelihood estimates, non-linear mixed effects models, missing data in mixed effects models, and Bayesian estimation of mixed effects models. Mixed models are applied in many disciplines where multiple correlated measurements are made on each unit of interest. They are prominently used in research involving human and animal subjects in fields ranging from genetics to marketing, and have also been used in baseball [14] and industrial statistics.[15] The mixed linear model association has improved the prevention of false positive associations. Populations are deeply interconnected and the relatedness structure of population dynamics is extremely difficult to model without the use of mixed models. Linear mixed models may not, however, be the only solution. LMM's have a constant-residual variance assumption that is sometimes violated when accounting or deeply associated continuous and binary traits.[16]
In matrix notation a linear mixed model can be represented as
\boldsymbol{y}=X\boldsymbol{\beta}+Z\boldsymbol{u}+\boldsymbol{\epsilon}
where
\boldsymbol{y}
E(\boldsymbol{y})=X\boldsymbol{\beta}
\boldsymbol{\beta}
\boldsymbol{u}
E(\boldsymbol{u})=\boldsymbol{0}
\operatorname{var}(\boldsymbol{u})=G
\boldsymbol{\epsilon}
E(\boldsymbol{\epsilon})=\boldsymbol{0}
\operatorname{var}(\boldsymbol{\epsilon})=R
X
\boldsymbol{y}
\boldsymbol{\beta}
Z
\boldsymbol{y}
\boldsymbol{u}
For example, if each observation can belong to any zero or more of categories then, which has one row per observation, can be chosen to have columns, where a value of for a matrix element of indicates that an observation is known to belong to a category and a value of indicates that an observation is known to not belong to a category. The inferred value of for a category is then a category-specific intercept. If has additional columns, where the non-zero values are instead the value of an independent variable for an observation, then the corresponding inferred value of is a category-specific slope for that independent variable. The prior distribution for the category intercepts and slopes is described by the covariance matrix .
The joint density of
\boldsymbol{y}
\boldsymbol{u}
f(\boldsymbol{y},\boldsymbol{u})=f(\boldsymbol{y}|\boldsymbol{u})f(\boldsymbol{u})
\boldsymbol{u}\siml{N}(\boldsymbol{0},G)
\boldsymbol{\epsilon}\siml{N}(\boldsymbol{0},R)
Cov(\boldsymbol{u},\boldsymbol{\epsilon})=\boldsymbol{0}
\boldsymbol{\beta}
\boldsymbol{u}
\begin{pmatrix} X'R-1X&X'R-1Z\\ Z'R-1X&Z'R-1Z+G-1\end{pmatrix} \begin{pmatrix} \hat{\boldsymbol{\beta}}\\ \hat{\boldsymbol{u}} \end{pmatrix} =\begin{pmatrix} X'R-1\boldsymbol{y}\\ Z'R-1\boldsymbol{y} \end{pmatrix}
The solutions to the MME,
style\hat{\boldsymbol{\beta}}
style\hat{\boldsymbol{u}}
\boldsymbol{\beta}
\boldsymbol{u}
One method used to fit such mixed models is that of the expectation–maximization algorithm (EM) where the variance components are treated as unobserved nuisance parameters in the joint likelihood.[18] Currently, this is the method implemented in statistical software such as Python (statsmodels package) and SAS (proc mixed), and as initial step only in R's nlme package lme. The solution to the mixed model equations is a maximum likelihood estimate when the distribution of the errors is normal.[19] [20] There are several other methods to fit mixed models, including using a mixed effect model (MEM) initially, and then Newton-Raphson (used by R package nlme[21] 's lme), penalized least squares to get a profiled log likelihood only depending on the (low-dimensional) variance-covariance parameters of
\boldsymbol{u}
\boldsymbol{G}