I have the following problem:
Obviously I want the =
to be aligned and I need two lines for the equation following the third =
.
Also I'm not so sure whether I used the \big{[}
and \big{]}
commands correctly!?
Code so far as follows:
\documentclass[12pt, a4paper] {article}
\usepackage{amsmath}
\DeclareMathOperator{\var}{var}
\usepackage{mathdesign}
\renewcommand{\vec}[1]{\mathbf{#1}}
\begin{document}
\begin{equation}
\begin{split}
\vec{V}_i &= E[\boldsymbol{\hat{\vec{\varepsilon}}}^*_i \boldsymbol{\hat{\vec{\varepsilon}}}^*_{i}' \;\;|\;\; \vec{X}^*_i]\\
&= \big{[}[\boldsymbol{\vec{\varepsilon}}^*_i - \vec{X}^*_i (\hat{\vec{\theta}}_i - \vec{\theta}_i)] [\boldsymbol{\vec{\varepsilon}}^*_i - \vec{X}^*_i (\hat{\vec{\theta}}_i - \vec{\theta}_i)]' \;\;|\;\; \vec{X}^*_{i}\big{]}
&= E[\boldsymbol{\vec{\varepsilon}}^*_i \boldsymbol{\vec{\varepsilon}}^*_{i}' - \boldsymbol{\vec{\varepsilon}}^*_i (\hat{\vec{\theta}}_i - \vec{\theta}_i)' \vec{X}^*_{i}' - \vec{X}^*_i (\hat{\vec{\theta}}_i - \vec{\theta}_i) \boldsymbol{\vec{\varepsilon}}^*_{i}'\\ + \vec{X}^*_i (\hat{\vec{\theta}}_i - \vec{\theta}_i) (\hat{\vec{\theta}}_i - \vec{\theta}_i)' \vec{X}^*_{i}' \;\;|\;\; \vec{X}^*_i]\\
&= \vec{I} \sigma^2_{\boldsymbol{\vec{\varepsilon}}^*_{i}} + \vec{X}^*_i (\vec{X}'_i \vec{X}_i)^{-1} \vec{X}^*_{i}' \sigma^2_{\boldsymbol{\vec{\varepsilon}}^*_{i}}.
\label{eq: covariance}
\end{split}
\end{equation}
\end{document}
Best Answer
You can use the
multlined
environment frommathtools
. I also defined an\EV
command, that works with agiven
command (following an example in the mathtools documentation). It has a simple syntax (\EV{A \given B}
and gives a correct spacing for theExpected Value
, and has delimiters and vertical line that adapt to the contents size in thestar
version; otherwise, it can take an optional argument (\big, \Big
, &c.) for the size. Unfortunately, it doesn't work with line breaks, so the multilined part had to be done by hand.