Gaussian covariance diagonality likelihood-ratio test (source code)

= Gaussian covariance diagonality likelihood-ratio test
{c}
{title2=$W=n\log(\prod_jS_{jj}/\det S)$}

For independent observations from a nonsingular <multivariate normal distribution> with unknown mean, let $S=n^{-1}\sum_i(y_i-\bar y)(y_i-\bar y)^T$. The unrestricted <maximum-likelihood estimator> of covariance is $S$, while the diagonal restriction gives $D=\operatorname{diag}(S_{11},\ldots,S_{pp})$. The fitted trace terms both equal $p$, so twice the log-likelihood difference is $W=n\log(\det D/\det S)=-n\log\det R$, where $R$ is the <sample correlation matrix>. Under the diagonal null hypothesis and fixed dimension, the <Wilks theorem> gives $W\Rightarrow\chi^2_{p(p-1)/2}$.