$$
\begin{array}{l} \log \int p (\mathbf {Y} ^ {(2)} | \mathbf {Y} ^ {(1)}, \hat {\mathbf {Y}} ^ {(1)}) p (\hat {\mathbf {Y}} ^ {(1)} | \mathbf {Y} ^ {(1)}) d \hat {\mathbf {Y}} ^ {(0)} \\ = - \frac {\left(N ^ {(2)} + N _ {n} ^ {(2)}\right) D}{2} \log (2 \pi) - \frac {1}{2} \log \left| \mathbf {K} _ {a} ^ {(1 1)} \right| - \frac {1}{2} \log \left| \hat {\boldsymbol {\Sigma}} ^ {(1)} \right| \\ + \log \int \exp \left\{- \frac {1}{2} \left(\mathbf {E} ^ {(2)} \breve {\mathbf {Y}} ^ {(2)} - \mathbf {E} ^ {(2)} \breve {\mathbf {Y}} ^ {(1)}\right) ^ {\top} \left(\mathbf {K} _ {a} ^ {(2 2)}\right) ^ {- 1} \left(\mathbf {E} ^ {(2)} \breve {\mathbf {Y}} ^ {(2)} - \mathbf {E} ^ {(2)} \breve {\mathbf {Y}} ^ {(1)}\right) \right. \\ - \left(\mathbf {E} ^ {(2)} \check {\mathbf {Y}} ^ {(2)} - \mathbf {E} ^ {(2)} \check {\mathbf {Y}} ^ {(1)}\right) ^ {\top} \left(\mathbf {K} _ {a} ^ {(2 2)}\right) ^ {- 1} \left(\hat {\mathbf {E}} ^ {(2)} \hat {\mathbf {Y}} ^ {(2)} - \hat {\mathbf {E}} ^ {(2)} \hat {\mathbf {Y}} ^ {(1)}\right) \\ - \frac {1}{2} \left(\hat {\mathbf {E}} ^ {(2)} \hat {\mathbf {Y}} ^ {(2)} - \hat {\mathbf {E}} ^ {(2)} \hat {\mathbf {Y}} ^ {(1)}\right) ^ {\top} \left(\mathbf {K} _ {a} ^ {(2 2)}\right) ^ {- 1} \left(\hat {\mathbf {E}} ^ {(2)} \hat {\mathbf {Y}} ^ {(2)} - \hat {\mathbf {E}} ^ {(2)} \hat {\mathbf {Y}} ^ {(1)}\right) \\ \left. - \frac {1}{2} \left(\hat {\mathbf {Y}} ^ {(1)}\right) ^ {\top} \left(\hat {\boldsymbol {\Sigma}} ^ {(1)}\right) ^ {- 1} \left(\hat {\mathbf {Y}} ^ {(1)}\right) + \left(\bar {\mathbf {Y}} ^ {(1)}\right) ^ {\top} \left(\hat {\boldsymbol {\Sigma}} ^ {(1)}\right) ^ {- 1} \left(\bar {\mathbf {Y}} ^ {(1)}\right) - \frac {1}{2} \left(\bar {\mathbf {Y}} ^ {(1)}\right) ^ {\top} \left(\hat {\boldsymbol {\Sigma}} ^ {(1)}\right) ^ {- 1} \left(\bar {\mathbf {Y}} ^ {(1)}\right) \right\} d \hat {\mathbf {Y}} ^ {(1)} \\ = - \frac {\left(N ^ {(2)} + N _ {n} ^ {(2)}\right) D}{2} \log (2 \pi) - \frac {1}{2} \log \left| \mathbf {K} _ {a} ^ {(1 1)} \right| - \frac {1}{2} \log \left| \hat {\boldsymbol {\Sigma}} ^ {(1)} \right| \\ - \frac {1}{2} \left(\mathbf {E} ^ {(2)} \breve {\mathbf {Y}} ^ {(2)} - \mathbf {E} ^ {(2)} \breve {\mathbf {Y}} ^ {(1)}\right) ^ {\top} \left(\mathbf {K} _ {a} ^ {(2 2)}\right) ^ {- 1} \left(\mathbf {E} ^ {(2)} \breve {\mathbf {Y}} ^ {(2)} - \mathbf {E} ^ {(2)} \breve {\mathbf {Y}} ^ {(1)}\right) \\ - \left(\mathbf {E} ^ {(2)} \breve {\mathbf {Y}} ^ {(2)} - \mathbf {E} ^ {(2)} \breve {\mathbf {Y}} ^ {(1)}\right) ^ {\top} \left(\mathbf {K} _ {a} ^ {(2 2)}\right) ^ {- 1} \left(\hat {\mathbf {E}} ^ {(2)} \breve {\mathbf {Y}} ^ {(2)}\right) - \frac {1}{2} \left(\hat {\mathbf {E}} ^ {(2)} \breve {\mathbf {Y}} ^ {(2)}\right) ^ {\top} \left(\mathbf {K} _ {a} ^ {(2 2)}\right) ^ {- 1} \left(\hat {\mathbf {E}} ^ {(2)} \breve {\mathbf {Y}} ^ {(2)}\right) \\ - \frac {1}{2} \left(\bar {\mathbf {Y}} ^ {(1)}\right) ^ {\top} \left(\hat {\boldsymbol {\Sigma}} ^ {(1)}\right) ^ {- 1} \left(\bar {\mathbf {Y}} ^ {(1)}\right) \\ + \log \int \exp \left\{\left(\mathbf {E} ^ {(2)} \check {\mathbf {Y}} ^ {(2)} - \mathbf {E} ^ {(2)} \check {\mathbf {Y}} ^ {(1)}\right) ^ {\top} \left(\mathbf {K} _ {a} ^ {(2 2)}\right) ^ {- 1} \left(\hat {\mathbf {E}} ^ {(2)} \hat {\mathbf {Y}} ^ {(1)}\right) \right. \\ + \left(\hat {\mathbf {E}} ^ {(2)} \hat {\mathbf {Y}} ^ {(2)}\right) ^ {\top} \left(\mathbf {K} _ {a} ^ {(2 2)}\right) ^ {- 1} \left(\hat {\mathbf {E}} ^ {(2)} \hat {\mathbf {Y}} ^ {(1)}\right) - \frac {1}{2} \left(\hat {\mathbf {E}} ^ {(2)} \hat {\mathbf {Y}} ^ {(1)}\right) ^ {\top} \left(\mathbf {K} _ {a} ^ {(2 2)}\right) ^ {- 1} \left(\hat {\mathbf {E}} ^ {(2)} \hat {\mathbf {Y}} ^ {(1)}\right) \\ \left. - \frac {1}{2} \left(\hat {\mathbf {Y}} ^ {(1)}\right) ^ {\top} \left(\hat {\boldsymbol {\Sigma}} ^ {(1)}\right) ^ {- 1} \left(\hat {\mathbf {Y}} ^ {(1)}\right) + \left(\bar {\mathbf {Y}} ^ {(1)}\right) ^ {\top} \left(\hat {\boldsymbol {\Sigma}} ^ {(1)}\right) ^ {- 1} \left(\hat {\mathbf {Y}} ^ {(1)}\right) \right\} \\ = - \frac {\left(N ^ {(2)} + N _ {n} ^ {(2)}\right) D}{2} \log (2 \pi) - \frac {1}{2} \log \left| \mathbf {K} _ {a} ^ {(1 1)} \right| - \frac {1}{2} \log \left| \hat {\boldsymbol {\Sigma}} ^ {(1)} \right| \\ - \frac {1}{2} \left(\mathbf {E} ^ {(2)} \check {\mathbf {Y}} ^ {(2)} - \mathbf {E} ^ {(2)} \check {\mathbf {Y}} ^ {(1)}\right) ^ {\top} \left(\mathbf {K} _ {a} ^ {(2 2)}\right) ^ {- 1} \left(\mathbf {E} ^ {(2)} \check {\mathbf {Y}} ^ {(2)} - \mathbf {E} ^ {(2)} \check {\mathbf {Y}} ^ {(1)}\right) \\ - \left(\mathbf {E} ^ {(2)} \breve {\mathbf {Y}} ^ {(2)} - \mathbf {E} ^ {(2)} \breve {\mathbf {Y}} ^ {(1)}\right) ^ {\top} \left(\mathbf {K} _ {a} ^ {(2 2)}\right) ^ {- 1} \left(\hat {\mathbf {E}} ^ {(2)} \hat {\mathbf {Y}} ^ {(2)}\right) - \frac {1}{2} \left(\hat {\mathbf {E}} ^ {(2)} \hat {\mathbf {Y}} ^ {(2)}\right) ^ {\top} \left(\mathbf {K} _ {a} ^ {(2 2)}\right) ^ {- 1} \left(\hat {\mathbf {E}} ^ {(2)} \hat {\mathbf {Y}} ^ {(2)}\right) \\ - \frac {1}{2} \left(\bar {\mathbf {Y}} ^ {(1)}\right) ^ {\top} \left(\hat {\boldsymbol {\Sigma}} ^ {(1)}\right) ^ {- 1} \left(\bar {\mathbf {Y}} ^ {(1)}\right) \\ + \log \int \exp \left\{- \frac {1}{2} \left(\hat {\mathbf {Y}} ^ {(1)}\right) ^ {\top} \left((\hat {\mathbf {E}} ^ {(2)}) ^ {\top} \left(\mathbf {K} _ {a} ^ {(2 2)}\right) ^ {- 1} \hat {\mathbf {E}} ^ {(2)} + \left(\hat {\mathbf {\Sigma}} ^ {(1)}\right) ^ {- 1}\right) \hat {\mathbf {Y}} ^ {(1)} \right. \\ \left. + \left[ \left(\mathbf {E} ^ {(2)} \breve {\mathbf {Y}} ^ {(2)} - \mathbf {E} ^ {(2)} \breve {\mathbf {Y}} ^ {(1)}\right) ^ {\top} \left(\mathbf {K} _ {a} ^ {(2 2)}\right) ^ {- 1} \hat {\mathbf {E}} ^ {(2)} + \left(\hat {\mathbf {E}} ^ {(2)} \hat {\mathbf {Y}} ^ {(2)}\right) ^ {\top} \left(\mathbf {K} _ {a} ^ {(2 2)}\right) ^ {- 1} \hat {\mathbf {E}} ^ {(2)} + \left(\bar {\mathbf {Y}} ^ {(1)}\right) ^ {\top} \left(\hat {\mathbf {Z}} ^ {(1)}\right) ^ {- 1} \right] \hat {\mathbf {Y}} ^ {(1)} \right\} d \hat {\mathbf {Y}} ^ {(1)} \\ = - \frac {N ^ {(2)} D}{2} \log (2 \pi) - \frac {1}{2} \log \left| \mathbf {K} _ {a} ^ {(1 1)} \right| - \frac {1}{2} \log \left| \hat {\mathbf {S}} ^ {(1)} \right| + \frac {1}{2} \log \left| (\hat {\mathbf {E}} ^ {(2)}) ^ {\top} (\mathbf {K} _ {a} ^ {(2 2)}) ^ {- 1} \hat {\mathbf {E}} ^ {(2)} + (\hat {\mathbf {S}} ^ {(1)}) ^ {- 1} \right| \\ - \frac {1}{2} \left(\mathbf {E} ^ {(2)} \check {\mathbf {Y}} ^ {(2)} - \mathbf {E} ^ {(2)} \check {\mathbf {Y}} ^ {(1)}\right) ^ {\top} \left(\mathbf {K} _ {a} ^ {(2 2)}\right) ^ {- 1} \left(\mathbf {E} ^ {(2)} \check {\mathbf {Y}} ^ {(2)} - \mathbf {E} ^ {(2)} \check {\mathbf {Y}} ^ {(1)}\right) \\ - \left(\mathbf {E} ^ {(2)} \breve {\mathbf {Y}} ^ {(2)} - \mathbf {E} ^ {(2)} \breve {\mathbf {Y}} ^ {(1)}\right) ^ {\top} \left(\mathbf {K} _ {a} ^ {(2 2)}\right) ^ {- 1} \left(\hat {\mathbf {E}} ^ {(2)} \breve {\mathbf {Y}} ^ {(2)}\right) - \frac {1}{2} \left(\hat {\mathbf {E}} ^ {(2)} \breve {\mathbf {Y}} ^ {(2)}\right) ^ {\top} \left(\mathbf {K} _ {a} ^ {(2 2)}\right) ^ {- 1} \left(\hat {\mathbf {E}} ^ {(2)} \breve {\mathbf {Y}} ^ {(2)}\right) \\ - \frac {1}{2} \left(\bar {\mathbf {Y}} ^ {(1)}\right) ^ {\top} \left(\hat {\boldsymbol {\Sigma}} ^ {(1)}\right) ^ {- 1} \left(\bar {\mathbf {Y}} ^ {(1)}\right) \\ + \frac {1}{2} \left(\phi^ {\top} \left(\mathbf {K} _ {a} ^ {(2 2)}\right) ^ {- 1} \hat {\mathbf {E}} ^ {(2)}\right) \left((\hat {\mathbf {E}} ^ {(2)}) ^ {\top} \left(\mathbf {K} _ {a} ^ {(2 2)}\right) ^ {- 1} \hat {\mathbf {E}} ^ {(2)} + \left(\hat {\mathbf {S}} ^ {(1)}\right) ^ {- 1}\right) ^ {- 1} \left(\left(\hat {\mathbf {E}} ^ {(2)}\right) \left(\mathbf {K} _ {a} ^ {(2 2)}\right) ^ {- 1} \phi\right) \\ + \left(\phi^ {\top} \left(\mathbf {K} _ {a} ^ {(2 2)}\right) ^ {- 1} \hat {\mathbf {E}} ^ {(2)}\right) \left((\hat {\mathbf {E}} ^ {(2)}) ^ {\top} \left(\mathbf {K} _ {a} ^ {(2 2)}\right) ^ {- 1} \hat {\mathbf {E}} ^ {(2)} + \left(\hat {\boldsymbol {\Sigma}} ^ {(1)}\right) ^ {- 1}\right) ^ {- 1} \left(\left(\hat {\boldsymbol {\Sigma}}\right) ^ {- 1} \bar {\mathbf {Y}} ^ {(1)}\right) \\ + \frac {1}{2} \left(\left(\bar {\mathbf {Y}} ^ {(1)}\right) ^ {\top} \left(\hat {\boldsymbol {\Sigma}}\right) ^ {- 1}\right) \left(\left(\hat {\mathbf {E}} ^ {(2)}\right) ^ {\top} \left(\mathbf {K} _ {a} ^ {(2 2)}\right) ^ {- 1} \hat {\mathbf {E}} ^ {(2)} + \left(\hat {\boldsymbol {\Sigma}} ^ {(1)}\right) ^ {- 1}\right) ^ {- 1} \left(\left(\hat {\boldsymbol {\Sigma}}\right) ^ {- 1} \bar {\mathbf {Y}} ^ {(1)}\right). \tag {A.48} \\ \end{array}
$$