amv26 - Distribution of Quadratic Forms. Normality of Marginal Distributions.

preview_player
Показать описание
Help this channel to remain great! Donating to Patreon or Paypal can do this!
Рекомендации по теме
Комментарии
Автор

begin video 3

\newpage
\subsection{Transformation of a MVN R.V. to a $\chi^2$ Distribution}
Let $\mathbf{y} \sim N_p(\boldsymbol{\mu}, \boldsymbol{\Sigma})$. Since $\mathbf z = (\mathbf{y} - \boldsymbol{\mu}) \sim N_p(\mathbf{0}, \mathbf{I})$, then $z_1, z_2, \ldots, z_p$ are all independent, and $z_j^2 \sim \chi_1^2 = \chi^2(1), \forall j \in {1, 2, \dots, p}$. Thus,
$$
\sum_{j=1}^p z_j^2 = \mathbf{z'z} = (\mathbf{y} - \boldsymbol{\mu})' \boldsymbol{\Sigma}^{-1} (\mathbf{y} - \boldsymbol{\mu}) \sim \chi_p^2 = \chi^2(p)
$$

\subsubsection{R Illustration}
\normalsize
<<fig.width=7, fig.height=5, cache=TRUE>>=
library(MASS) # load library MASS
n <- 1000
mu <- c(10, 5, 7, 9, 20)
Sig <- matrix(c(
5, 4, 3, 2, 1,
4, 5, 4, 3, 2,
3, 4, 5, 4, 3,
2, 3, 4, 5, 4,
1, 2, 3, 4, 5), ncol = 5)

Y <- mvrnorm(n, mu, Sig) # sample mvn data
z.z <- mahalanobis(Y, mu, Sig)

hist(z.z, probability = TRUE, xlab="z'z",
main="Multivariate Normal to Chi-square Distribution")
lines(seq(0, 20, .01), dchisq(seq(0, 20, .01), ncol(Sig)), col='red', lwd=2)
legend("topright", c("Chi-sq Dist w/ df=5"), lty=1, col='red')
@
\LARGE

\subsection{Marginal Distribution of Multivariate Normal}
If $\mathbf{y} \sim N_p(\boldsymbol\mu, \boldsymbol\Sigma)$, then

\begin{enumerate}
\item The marginal of any element of $\mathbf y$ is univariate normal. That is, $y_j \sim N(\mu_j, \sigma_{jj}), \;\;j=1, 2, \ldots, p$.
\item If $\sigma_{jk}=0 \iff$ $y_j$ and $y_k$ are independent.\footnote{Note that, this is not necessarily true for non-normal random variables.}
\end{enumerate}

Similarly, if we consider any arbitrary partition of $\mathbf{y}$ into two subvectors such as
$$
\mathbf y = \begin{pmatrix}
\mathbf y_1 \\
\mathbf y_2
\end{pmatrix}, \;\;\; \boldsymbol \mu=
\begin{pmatrix}
\boldsymbol \mu_1 \\
\boldsymbol \mu_2
\end{pmatrix}, \;\;\; \boldsymbol \Sigma=
\begin{pmatrix}
\boldsymbol \Sigma_{11} & \boldsymbol \Sigma_{12}\\
\boldsymbol \Sigma_{21} & \boldsymbol \Sigma_{22}
\end{pmatrix},
$$
where $\mathbf y_1$ and $\boldsymbol \mu_1$ are $r \times 1$ and $\boldsymbol \Sigma_{11}$ is $r \times r$, then,
\begin{enumerate}
\item The marginal of any subset of $\mathbf y$ is multivariate normal. That is, $\mathbf y_1 \sim N_r (\boldsymbol \mu_1, \boldsymbol \Sigma_{11}).$
\item If $\boldsymbol \Sigma_{12}=\mathbf{O} \iff$ $\mathbf y_1$ and $\mathbf y_2$ are independent.\footnotemark[1]
\end{enumerate}


\subsubsection{R Illustration}
\normalsize
<<fig.width=7, fig.height=6, cache=TRUE, warning=FALSE>>=
library(MASS) # load library MASS
n <- 1000
mu <- c(10, 5, 7, 9, 20)
Sig <- matrix(c(
5, 4, 3, 2, 1,
4, 5, 4, 3, 2,
3, 4, 5, 4, 3,
2, 3, 4, 5, 4,
1, 2, 3, 4, 5), ncol = 5)
Y <- mvrnorm(n, mu, Sig) # sample mvn data

h1 <- hist(Y[, 1], breaks=25, plot=F)
h2 <- hist(Y[, 2], breaks=25, plot=F)
top <- max(h1$counts, h2$counts)
k <- kde2d(Y[, 1], Y[, 2], n=25)
# margins
oldmar <-par()$mar
par(mar=c(3, 3, 1, 1))
layout(matrix(c(2, 0, 1, 3), 2, 2, byrow=T), c(3, 1), c(1, 3))
image(k) #plot the image
par(mar=c(0, 2, 1, 0))
barplot(h1$counts, axes=F, ylim=c(0, top), space=0, col='red')
par(mar=c(2, 0, 0.5, 1))
barplot(h2$counts, axes=F, xlim=c(0, top), space=0, col='red', horiz=T)
par(mar = oldmar)
@
\LARGE

end video 3

statisticsmatt