\newcommand{\bm}[1]{\boldsymbol{#1}} \newcommand{\N}{\mathcal{N}} \newcommand{\XX}{{\bm{X}}} \newcommand{\ZZ}{{\bm{Z}}} \newcommand{\Eps}{{\bm{\varepsilon}}} \newcommand{\PPs}{{\bm{\Psi}}} \newcommand{\LLa}{{\bm{\Lambda}}} \newcommand{\ssi}{{\bm{\sigma}}} \newcommand{\SSi}{{\bm{\Sigma}}} \newcommand{\OOm}{{\bm{\Omega}}} \newcommand{\bz}{{\bm{0}}} \newcommand{\Id}{{\bm{I}}} \newcommand{\diag}{\operatorname{diag}} \newcommand{\bO}{\operatorname{\mathcal{O}}}

knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

Setup

The Gaussian factor model for $\XX = (X_1, \ldots, X_q)$ is given by \begin{equation} \XX_{q\times 1} = \LLa_{q \times k} \ZZ_{k \times 1} + \Eps_{q\times 1}, (#eq:gfm) \end{equation} where $\ZZ \sim \N(\bz,\Id_k)$ for $k \le q$, $\LLa$ is a (deterministic) loading matrix, and $\Eps \sim \N(\bz, \PPs)$, where $\PPs = \diag(\ssi^2) = \diag(\sigma_1^2, \ldots, \sigma_q^2)$. The distribution of $\XX$ is thus multivariate normal, $$ \XX \sim \N(\bz, \LLa\LLa' + \PPs). $$

Efficient Density Evaluation

The log-density of the Gaussian factor model \@ref(eq:gfm) is $$ \log p(\XX \mid \LLa, \ssi) = \tfrac 1 2 \left{\XX' \SSi^{-1} \XX + \log |\SSi| \right}, \qquad \SSi = \LLa\LLa' + \PPs. $$ If calculated directly, the computational cost is $\bO(q^3)$ as incurred by the matrix inversion. However, the Wodbury formula allows the inverse to be computed as $$ \begin{aligned} (\PPs + \LLa\LLa')^{-1} = \PPs^{-1} - \PPs^{-1}\LLa\OOm^{-1}\LLa'\PPs^{-1}, \qquad \OOm = \Id_k + \LLa'\PPs^{-1}\LLa. \end{aligned} $$ The cost of the inversion is thus $\bO(k^4q)$, which can be much smaller than $\bO(q^3)$ when $k \ll q$. Similarly for the log-determinant, by the matrix determinant lemma we have $$ \log |\PPs + \LLa\LLa'| = \log |\PPs| + \log|\OOm|. $$



mlysy/svcommon documentation built on Sept. 15, 2024, 1:15 a.m.