# Matrix F-distribution

In statistics, the matrix F distribution (or matrix variate F distribution) is a matrix variate generalization of the F distribution which is defined on real-valued positive-definite matrices. In Bayesian statistics it can be used as the semi conjugate prior for the covariance matrix or precision matrix of multivariate normal distributions, and related distributions.

## Density

The probability density function of the matrix $F$ distribution is:
$f_{\mathbf {X} }({\mathbf {X} };{\mathbf {\Psi } },\nu ,\delta )={\frac {\Gamma _{p}\left({\frac {\nu +\delta +p-1}{2}}\right)}{\Gamma _{p}\left({\frac {\nu }{2}}\right)\Gamma _{p}\left({\frac {\delta +p-1}{2}}\right)|\mathbf {\Psi } |^{\frac {\nu }{2}}}}~|{\mathbf {X} }|^{\frac {\nu -p-1}{2}}|{\textbf {I}}_{p}+{\mathbf {X} }\mathbf {\Psi } ^{-1}|^{-{\frac {\nu +\delta +p-1}{2}}}$
where $\mathbf {X}$ and ${\mathbf {\Psi } }$ are $p\times p$ positive definite matrices, $|\cdot |$ is the determinant, Γ$_p$(⋅) is the multivariate gamma function, and ${\textbf {I}}_{p}$ is the p × p identity matrix.

## Properties
### Construction of the distribution

* The standard matrix F distribution, with an identity scale matrix $\mathbf {I} _{p}$, was originally derived by. When considering independent distributions,
${\mathbf {\Phi } _{1}}\sim {\mathcal {W}}({\mathbf {I} _{p}},\nu )$ and ${\mathbf {\Phi } _{2}}\sim {\mathcal {W}}({\mathbf {I} _{p}},\delta +k-1)$, and define $\mathbf {X} ={\mathbf {\Phi } _{2}}^{-1/2}{\mathbf {\Phi } _{1}}{\mathbf {\Phi } _{2}}^{-1/2}$, then $\mathbf {X} \sim {\mathcal {F}}({\mathbf {I} _{p}},\nu ,\delta )$.
* If ${\mathbf {X} }|\mathbf {\Phi } \sim {\mathcal {W}}^{-1}({\mathbf {\Phi } },\delta +p-1)$ and ${\mathbf {\Phi } }\sim {\mathcal {W}}({\mathbf {\Psi } },\nu )$, then, after integrating out $\mathbf {\Phi }$, $\mathbf {X}$ has a matrix F-distribution, i.e.,
$f_{\mathbf {X} |\mathbf {\Phi } ,\nu ,\delta }(\mathbf {X} )=\int f_{\mathbf {X} |\mathbf {\Phi } ,\delta +p-1}(\mathbf {X} )f_{\mathbf {\Phi } |\mathbf {\Psi } ,\nu }(\mathbf {\Phi } )d\mathbf {\Phi } .$ This construction is useful to construct a semi-conjugate prior for a covariance matrix.
* If ${\mathbf {X} }|\mathbf {\Phi } \sim {\mathcal {W}}({\mathbf {\Phi } },\nu )$ and ${\mathbf {\Phi } }\sim {\mathcal {W}}^{-1}({\mathbf {\Psi } },\delta +p-1)$, then, after integrating out $\mathbf {\Phi }$, $\mathbf {X}$ has a matrix F-distribution, i.e., $f_{\mathbf {X} |\mathbf {\Psi } ,\nu ,\delta }(\mathbf {X} )=\int f_{\mathbf {X} |\mathbf {\Phi } ,\nu }(\mathbf {X} )f_{\mathbf {\Phi } |\mathbf {\Psi } ,\delta +p-1}(\mathbf {\Phi } )d\mathbf {\Phi } .$ This construction is useful to construct a semi-conjugate prior for a precision matrix.

### Marginal distributions from a matrix F distributed matrix

Suppose ${\mathbf {A} }\sim F({\mathbf {\Psi } },\nu ,\delta )$ has a matrix F distribution. Partition the matrices ${\mathbf {A} }$ and ${\mathbf {\Psi } }$ conformably with each other
    ${\mathbf {A} }={\begin{bmatrix}\mathbf {A} _{11}&\mathbf {A} _{12}\\\mathbf {A} _{21}&\mathbf {A} _{22}\end{bmatrix}},\;{\mathbf {\Psi } }={\begin{bmatrix}\mathbf {\Psi } _{11}&\mathbf {\Psi } _{12}\\\mathbf {\Psi } _{21}&\mathbf {\Psi } _{22}\end{bmatrix}}$
where ${\mathbf {A} _{ij}}$ and ${\mathbf {\Psi } _{ij}}$ are $p_{i}\times p_{j}$ matrices, then we have ${\mathbf {A} _{11}}\sim F({\mathbf {\Psi } _{11}},\nu ,\delta )$.

### Moments

Let $X\sim F({\mathbf {\Psi } },\nu ,\delta )$.
The mean is given by: $E(\mathbf {X} )={\frac {\nu }{\delta -2}}\mathbf {\Psi } .$
The (co)variance of elements of $\mathbf {X}$ are given by:
    $\operatorname {cov} (X_{ij},X_{ml})=\Psi _{ij}\Psi _{ml}{\tfrac {2\nu ^{2}+2\nu (\delta -2)}{(\delta -1)(\delta -2)^{2}(\delta -4)}}+(\Psi _{il}\Psi _{jm}+\Psi _{im}\Psi _{jl})\left({\tfrac {2\nu +\nu ^{2}(\delta -2)+\nu (\delta -2)}{(\delta -1)(\delta -2)^{2}(\delta -4)}}+{\tfrac {\nu }{(\delta -2)^{2}}}\right).$

## Related distributions

* The matrix F-distribution has also been termed the multivariate beta II distribution. See also, for a univariate version.
* A univariate version of the matrix F distribution is the F-distribution. With $p=1$ (i.e. univariate) and $\mathbf {\Psi } =1$, and $x=\mathbf {X}$, the probability density function of the matrix F distribution becomes the univariate (unscaled) F distribution: $f_{x\mid \nu ,\delta }(x)=\operatorname {B} \left({\tfrac {\nu }{2}},{\tfrac {\delta }{2}}\right)^{-1}\left({\tfrac {\nu }{\delta }}\right)^{\nu /2}x^{\nu /2-1}\left(1+{\tfrac {\nu }{\delta }}\,x\right)^{-(\nu +\delta )/2},$
* In the univariate case, with $p=1$ and $x=\mathbf {X}$, and when setting $\nu =1$, then ${\sqrt {x}}$ follows a half t distribution with scale parameter ${\sqrt {\psi }}$ and degrees of freedom $\delta$. The half t distribution is a common prior for standard deviations