# Modes of variation

In statistics, modes of variation are a continuously indexed set of vectors or functions that are centered at a mean and are used to depict the variation in a population or sample. Typically, variation patterns in the data can be decomposed in descending order of eigenvalues with the directions represented by the corresponding eigenvectors or eigenfunctions. Modes of variation provide a visualization of this decomposition and an efficient description of variation around the mean. Both in principal component analysis (PCA) and in functional principal component analysis (FPCA), modes of variation play an important role in visualizing and describing the variation in the data contributed by each eigencomponent. In real-world applications, the eigencomponents and associated modes of variation aid to interpret complex data, especially in exploratory data analysis (EDA).

## Formulation

Modes of variation are a natural extension of PCA and FPCA.

### Modes of variation in PCA

If a random vector $\mathbf {X} =(X_{1},X_{2},\cdots ,X_{p})^{T}$ has the mean vector ${\boldsymbol {\mu }}_{p}$, and the covariance matrix $\mathbf {\Sigma } _{p\times p}$ with eigenvalues $\lambda _{1}\geq \lambda _{2}\geq \cdots \geq \lambda _{p}\geq 0$ and corresponding orthonormal eigenvectors $\mathbf {e} _{1},\mathbf {e} _{2},\cdots ,\mathbf {e} _{p}$, by eigendecomposition of a real symmetric matrix, the covariance matrix $\mathbf {\Sigma }$ can be decomposed as
    $\mathbf {\Sigma } =\mathbf {Q} \mathbf {\Lambda } \mathbf {Q} ^{T},$
where $\mathbf {Q}$ is an orthogonal matrix whose columns are the eigenvectors of $\mathbf {\Sigma }$, and $\mathbf {\Lambda }$ is a diagonal matrix whose entries are the eigenvalues of $\mathbf {\Sigma }$. By the Karhunen–Loève expansion for random vectors, one can express the centered random vector in the eigenbasis
    $\mathbf {X} -{\boldsymbol {\mu }}=\sum _{k=1}^{p}\xi _{k}\mathbf {e} _{k},$
where $\xi _{k}=\mathbf {e} _{k}^{T}(\mathbf {X} -{\boldsymbol {\mu }})$ is the principal component associated with the $k$-th eigenvector $\mathbf {e} _{k}$, with the properties
    $\operatorname {E} (\xi _{k})=0,\operatorname {Var} (\xi _{k})=\lambda _{k},$ and $\operatorname {E} (\xi _{k}\xi _{l})=0\ {\text{for}}\ l\neq k.$
Then the $k$-th mode of variation of $\mathbf {X}$ is the set of vectors, indexed by $\alpha$,
    $\mathbf {m} _{k,\alpha }={\boldsymbol {\mu }}\pm \alpha {\sqrt {\lambda _{k}}}\mathbf {e} _{k},\alpha \in [-A,A],$
where $A$ is typically selected as $2\ {\text{or}}\ 3$.

### Modes of variation in FPCA

For a square-integrable random function $X(t),t\in {\mathcal {T}}\subset R^{p}$, where typically $p=1$ and ${\mathcal {T}}$ is an interval, denote the mean function by $\mu (t)=\operatorname {E} (X(t))$, and the covariance function by
    $G(s,t)=\operatorname {Cov} (X(s),X(t))=\sum _{k=1}^{\infty }\lambda _{k}\varphi _{k}(s)\varphi _{k}(t),$
where $\lambda _{1}\geq \lambda _{2}\geq \cdots \geq 0$ are the eigenvalues and $\{\varphi _{1},\varphi _{2},\cdots \}$ are the orthonormal eigenfunctions of the linear Hilbert–Schmidt operator
    $G:L^{2}({\mathcal {T}})\rightarrow L^{2}({\mathcal {T}}),\,G(f)=\int _{\mathcal {T}}G(s,t)f(s)ds.$
By the Karhunen–Loève theorem, one can express the centered function in the eigenbasis,
    $X(t)-\mu (t)=\sum _{k=1}^{\infty }\xi _{k}\varphi _{k}(t),$
where
    $\xi _{k}=\int _{\mathcal {T}}(X(t)-\mu (t))\varphi _{k}(t)dt$
is the $k$-th principal component with the properties
    $\operatorname {E} (\xi _{k})=0,\operatorname {Var} (\xi _{k})=\lambda _{k},$ and $\operatorname {E} (\xi _{k}\xi _{l})=0{\text{ for }}l\neq k.$
Then the $k$-th mode of variation of $X(t)$ is the set of functions, indexed by $\alpha$,
    $m_{k,\alpha }(t)=\mu (t)\pm \alpha {\sqrt {\lambda _{k}}}\varphi _{k}(t),\ t\in {\mathcal {T}},\ \alpha \in [-A,A]$
that are viewed simultaneously over the range of $\alpha$, usually for $A=2\ {\text{or}}\ 3$.

## Estimation

The formulation above is derived from properties of the population. Estimation is needed in real-world applications. The key idea is to estimate mean and covariance.

### Modes of variation in PCA

Suppose the data $\mathbf {x} _{1},\mathbf {x} _{2},\cdots ,\mathbf {x} _{n}$ represent $n$ independent drawings from some $p$-dimensional population $\mathbf {X}$ with mean vector ${\boldsymbol {\mu }}$ and covariance matrix $\mathbf {\Sigma }$. These data yield the sample mean vector ${\overline {\mathbf {x} }}$, and the sample covariance matrix $\mathbf {S}$ with eigenvalue-eigenvector pairs $({\hat {\lambda }}_{1},{\hat {\mathbf {e} }}_{1}),({\hat {\lambda }}_{2},{\hat {\mathbf {e} }}_{2}),\cdots ,({\hat {\lambda }}_{p},{\hat {\mathbf {e} }}_{p})$. Then the $k$-th mode of variation of $\mathbf {X}$ can be estimated by
    ${\hat {\mathbf {m} }}_{k,\alpha }={\overline {\mathbf {x} }}\pm \alpha {\sqrt {{\hat {\lambda }}_{k}}}{\hat {\mathbf {e} }}_{k},\alpha \in [-A,A].$

### Modes of variation in FPCA

Consider $n$ realizations $X_{1}(t),X_{2}(t),\cdots ,X_{n}(t)$ of a square-integrable random function $X(t),t\in {\mathcal {T}}$ with the mean function $\mu (t)=\operatorname {E} (X(t))$ and the covariance function $G(s,t)=\operatorname {Cov} (X(s),X(t))$. Functional principal component analysis provides methods for the estimation of $\mu (t)$ and $G(s,t)$ in detail, often involving point wise estimate and interpolation. Substituting estimates for the unknown quantities, the $k$-th mode of variation of $X(t)$ can be estimated by
    ${\hat {m}}_{k,\alpha }(t)={\hat {\mu }}(t)\pm \alpha {\sqrt {{\hat {\lambda }}_{k}}}{\hat {\varphi }}_{k}(t),t\in {\mathcal {T}},\alpha \in [-A,A].$

## Applications

Modes of variation are useful to visualize and describe the variation patterns in the data sorted by the eigenvalues. In real-world applications, modes of variation associated with eigencomponents allow to interpret complex data, such as the evolution of function traits and other infinite-dimensional data. To illustrate how modes of variation work in practice, two examples are shown in the graphs to the right, which display the first two modes of variation. The solid curve represents the sample mean function. The dashed, dot-dashed, and dotted curves correspond to modes of variation with $\alpha =\pm 1,\pm 2,$ and $\pm 3$, respectively.
The first graph displays the first two modes of variation of female mortality data from 41 countries in 2003. The object of interest is log hazard function between ages 0 and 100 years. The first mode of variation suggests that the variation of female mortality is smaller for ages around 0 or 100, and larger for ages around 25. An appropriate and intuitive interpretation is that mortality around 25 is driven by accidental death, while around 0 or 100, mortality is related to congenital disease or natural death.
Compared to female mortality data, modes of variation of male mortality data shows higher mortality after around age 20, possibly related to the fact that life expectancy for women is higher than that for men.