% NOTE -- ONLY EDIT THE .Rnw FILE!!!  The .tex file is
% likely to be overwritten.

\begin{frame}
  \frametitle{Definition of linear mixed models}
  \begin{itemize}
  \item As previously stated, we define a linear mixed model in terms
    of two random variables: the
    $n$-dimensional $\bm{\mathcal{Y}}$ and the $q$-dimensional
    $\bm{\mathcal{B}}$
  \item The probability model specifies the conditional distribution
    \begin{displaymath}
      \left(\bm{\mathcal{Y}}|\bm{\mathcal{B}}=
        \bm b\right)\sim\mathcal{N}\left(\bm
        X\bm\beta+\bm Z\bm b,\sigma^2\bm I\right)
    \end{displaymath}
    and the unconditional distribution
    \begin{displaymath}
      \bm{\mathcal{B}}\sim\mathcal{N}
      \left(\bm 0,\sigma^2\bm\Sigma(\bm\theta)\right),
      \quad(\bm{\mathcal{Y}}|\bm{\mathcal{B}})\perp\bm{\mathcal{B}}
    \end{displaymath}
    as independent, multivariate Gaussian distributions depending on
    the parameters $\bm\beta$, $\bm\theta$ and $\sigma$.
  \item The relative variance-covariance matrix for
    $\bm{\mathcal{B}}$, written $\bm\Sigma(\bm\theta)$, can be
    factored as
    \begin{displaymath}
      \bm\Sigma(\bm\theta)=\bm T(\bm\theta)\bm S(\bm\theta)\bm
      S(\bm\theta)\bm T(\bm\theta)\trans = (\bm T\bm S)(\bm T\bm S)\trans .
    \end{displaymath}
    We say that the product $\bm T(\bm\theta)\bm S(\bm\theta)$ is a
    left square-root factor of $\bm\Sigma(\bm\theta)$.
  \end{itemize}
\end{frame}

\begin{frame}
  \frametitle{The conditional distribution, $\bm{\mathcal{Y}}|\bm{\mathcal{B}}$}
  \begin{itemize}
  \item The mean of the conditional distribution,
    $\bm{\mathcal{Y}}|\bm{\mathcal{B}}$, is a linear function of
    $\bm\beta$ and $\bm b$.
    \begin{displaymath}
      \bm\mu_{\bm{\mathcal{Y}}|\bm{\mathcal{B}}}(\bm b)=
      \mathrm{E}[\bm{\mathcal{Y}}|\bm{\mathcal{B}}=\bm b] =
      \bm\eta=
      \bm X\bm\beta +\bm Z\bm b
    \end{displaymath}
  \item For generalized linear models we will distinguish between the
    conditional mean, $\bm\mu_{\bm{\mathcal{Y}}|\bm{\mathcal{B}}}(\bm
    b)$, which may be bounded, and the linear predictor, $\bm\eta$,
    which is always unbounded.  For linear mixed models,
    $\bm\mu_{\bm{\mathcal{Y}}|\bm{\mathcal{B}}}(\bm b)=\bm\eta$.
  \item Components of $\bm{\mathcal{Y}}$ are \Emph{conditionally
      independent}, given $\bm{\mathcal{B}}$.  That is, the conditional
    distribution, $(\bm{\mathcal{Y}}|\bm{\mathcal{B}}=\bm b)$, is
    determined by the (scalar) distribution of each
    component.
  \item Hence, the conditional distribution,
    $(\bm{\mathcal{Y}}|\bm{\mathcal{B}}=\bm b)$, is completely
    determined by the conditional mean,
    $\bm\mu_{\bm{\mathcal{Y}}|\bm{\mathcal{B}}}$, and the common scale
    parameter, $\sigma$.
  \end{itemize}
\end{frame}

\begin{frame}
  \frametitle{The unscaled conditional density of
    $\bm{\mathcal{B}}|\bm{\mathcal{Y}}=\bm y$}
  \begin{itemize}
  \item Because it is $\bm y$, not $\bm b$, that we observe, we are
    interested in evaluating the other conditional distribution,
    $(\bm{\mathcal{B}}|\bm{\mathcal{Y}}=\bm y)$.  We will write its
    density as $[\bm{\mathcal{B}}|\bm{\mathcal{Y}}](\bm b|\bm y)$ (it
    is always continuous, even when, as in some GLMMs,
    $\bm{\mathcal{Y}}$ is discrete).
  \item Given $\bm y$, $\bm\theta$, $\bm\beta$ and, if used, $\sigma$,
    we can evaluate $[\bm{\mathcal{B}}|\bm{\mathcal{Y}}](\bm b|\bm
    y)$, up to a scale factor, as
    $[\bm{\mathcal{Y}}|\bm{\mathcal{B}}](\bm y|\bm b)\,
    [\bm{\mathcal{B}}](\bm b)$.
  \item The inverse of the scale factor,
    \begin{displaymath}
      \int_{\mathbb{R}^q}[\bm{\mathcal{Y}}|\bm{\mathcal{B}}](\bm y|\bm b)\,
      [\bm{\mathcal{B}}](\bm b)\, d\bm b ,
    \end{displaymath}
    is exactly the \Emph{likelihood}, $L(\bm\theta,\bm\beta,\sigma^2|\bm y)$
    (or $L(\bm\theta,\bm\beta,|\bm y)$ when $\sigma$ is not used).
  \end{itemize}
\end{frame}

\begin{frame}
  \frametitle{The unscaled conditional density of
    $\bm{\mathcal{U}}|\bm{\mathcal{Y}}=\bm y$}
  \begin{itemize}
  \item To simplify the integral defining the likelihood, we change
    the variable of integration to $\bm u$, where $\bm{\mathcal{U}}$
    is a vector-valued random variable with unconditional distribution
    $\bm{\mathcal{U}}\sim\mathcal{N}(\bm 0,\sigma^2\bm I_q)$ (or 
    $\bm{\mathcal{U}}\sim\mathcal{N}(\bm 0,\bm I_q)$, when $\sigma$ is
    not used), and $\bm{\mathcal{B}}=\bm T(\bm\theta)\bm
    S(\bm\theta)\bm P\trans\bm{\mathcal{U}}$.
  \item The linear predictor, $\bm\eta$, which determines
    the conditional density,
    $[\bm{\mathcal{Y}}|\bm{\mathcal{U}}](\bm y|\bm u)$, becomes
    \begin{displaymath}
      \bm\eta=\bm Z\bm T(\bm\theta)\bm S(\bm\theta)\bm P\trans\bm u
      +\bm X\bm\beta=\bm A(\bm\theta)\trans\bm P\trans\bm u+\bm X\bm\beta,
    \end{displaymath}
    where $\bm A(\bm\theta)\trans=\bm Z\bm T(\bm\theta)\bm
    S(\bm\theta)$, and likelihood
    \begin{displaymath}
      L(\bm\theta,\bm\beta|\bm y)=
      \int_{\mathbb{R}^q}[\bm{\mathcal{Y}}|\bm{\mathcal{U}}](\bm y|\bm u)\,
      [\bm{\mathcal{U}}](\bm u)\, d\bm u .
    \end{displaymath}
  \end{itemize}
\end{frame}

\begin{frame}
  \frametitle{Maximizing the unscaled density $\bm{\mathcal{U}}|\bm{\mathcal{Y}}=\bm y$}
  \begin{itemize}
  \item In our general strategy for evaluating the likelihood,
    $L(\bm\theta,\bm\beta,\sigma^2|\bm y)$, we first maximize the
    unscaled density of $\bm{\mathcal{U}}|\bm{\mathcal{Y}}=\bm y$,
    w.r.t. $\bm u$.
  \item Both $[\bm{\mathcal{Y}}|\bm{\mathcal{U}}](\bm y|\bm u)$ and
    $[\bm{\mathcal{U}}](\bm u)$ are \Emph{spherical} normal densities,
    which means that the components are independent with constant
    variance, e.g. $\mathrm{Var}(\bm{\mathcal{U}})=\sigma^2\bm I$,
    (``spherical'' because the contours of constant density
    are spheres).
  \item That is, probability density is related to the (squared)
    lengths, $\|\bm y-\bm\mu_{\bm{\mathcal{Y}}|\bm{\mathcal{U}}}\|^2$
    and $\|\bm u\|^2$, with the same scale factor, $\sigma^2$.
  \item The \Emph{conditional mode} of $\bm U|\bm Y$ -- the
    value that maximizes the conditional density (and also the
    unscaled version) -- does not depend on $\sigma^2$.
  \end{itemize}
  \begin{align*}
    \tilde{\bm u}(\bm y|\bm\theta,\bm\beta)&=\arg\max_{\bm u}
    [\bm{\mathcal{Y}}|\bm{\mathcal{U}}](\bm y|\bm u)\, 
    [\bm{\mathcal{U}}](\bm u)\\
    &=\arg\min_{\bm u}\left(
      \|\bm y-\bm\mu_{\bm{\mathcal{Y}}|\bm{\mathcal{U}}}\|^2 +
      \|\bm u\|^2\right)
  \end{align*}
\end{frame}

\begin{frame}
  \frametitle{Solving for the conditional mode}
  \begin{itemize}
  \item Incorporating the definition of
    $\bm\mu_{\bm{\mathcal{Y}}|\bm{\mathcal{U}}}$ provides
    \begin{displaymath}
      \|\bm y-\bm\mu_{\bm{\mathcal{Y}}|\bm{\mathcal{U}}}\|^2=
      \|\bm y-\bm A\trans\bm P\trans\bm u-\bm X\bm\beta\|^2
    \end{displaymath}
  \item Recall that $\bm P$ is a permutation matrix.  These have the
    property that $\bm P^{-1}=\bm P\trans$, allowing us to write
    \begin{displaymath}
      \|\bm 0-\bm P\trans\bm u\|^2=\bm u\trans\bm P\bm P\trans\bm u=
      \bm u\trans\bm u=\|\bm u\|^2
    \end{displaymath}
  \item Combining these produces
    \begin{displaymath}
      \tilde{\bm u}(\bm y|\bm\theta,\bm\beta)=\arg\min_{\bm u}
      \left\|
        \begin{bmatrix}\bm y - \bm X\bm\beta\\\bm 0\end{bmatrix} -
        \begin{bmatrix}\bm A\trans\\\bm I\end{bmatrix}\bm P\trans\bm u
      \right\|^2
      \end{displaymath}
      Hence, $\tilde{\bm u}$ satisfies
      \begin{displaymath}
        \bm P\left(\bm A\bm A\trans+\bm I\right)\bm P\trans\tilde{\bm u}=
        \bm L\bm L\trans\tilde{\bm u}=\bm P\bm A(\bm y - \bm X\bm\beta)
      \end{displaymath}
      where $\bm L(\bm\theta)$ is the sparse left Cholesky factor of
      $\bm P\left(\bm A(\bm\theta)\bm A(\bm\theta)\trans+\bm
        I\right)\bm P\trans$.
  \end{itemize}
\end{frame}

\begin{frame}
  \frametitle{Evaluating the likelihood - linear mixed models}
  \begin{itemize}
  \item Because $\bm\mu_{\bm{\mathcal{Y}|\bm{\mathcal{U}}}}$ depends
    linearly on both $\bm u$ and $\bm\beta$, the conditional mode
    $\tilde{\bm u}(\bm\theta)$ and the conditional maximum likelihood
    estimate, $\widehat{\bm\beta}(\bm\theta)$, can be determined
    simultaneously as the solutions to a penalized least squares
    problem
    \begin{displaymath}
      \begin{bmatrix}
        \tilde{\bm u}(\bm\theta)\\
        \widehat{\bm\beta}(\bm\theta)
      \end{bmatrix}=
      \arg\min_{\bm u,\bm\beta}\left\|
        \begin{bmatrix}\bm y\\\bm 0\end{bmatrix} -
        \begin{bmatrix}
          \bm A\trans\bm P\trans & \bm X\\
          \bm I & \bm 0
        \end{bmatrix}
        \begin{bmatrix}\bm u\\\bm\beta\end{bmatrix}
      \right\|^2
    \end{displaymath}
    for which the solution satisfies
    \begin{displaymath}
      \begin{bmatrix}
        \bm P\left(\bm A\bm A\trans+\bm I\right)\bm P\trans & \bm P\bm
        A\bm X\\
        \bm X\trans\bm A\trans\bm P\trans & \bm X\trans\bm X
      \end{bmatrix}
      \begin{bmatrix}
        \tilde{\bm u}(\bm\theta)\\
        \widehat{\bm\beta}(\bm\theta)
      \end{bmatrix}=
      \begin{bmatrix}\bm P\bm A\bm y\\\bm X\trans\bm y\end{bmatrix}
    \end{displaymath}
  \item The Cholesky factor of the system matrix for the PLS problem
    is
    \begin{displaymath}
      \begin{bmatrix}
        \bm P\left(\bm A\bm A\trans+\bm I\right)\bm P\trans & \bm P\bm
        A\bm X\\
        \bm X\trans\bm A\trans\bm P\trans & \bm X\trans\bm X
      \end{bmatrix} =
      \begin{bmatrix}
        \bm L & \bm 0\\
        \bm R_{\bm Z\bm X}\trans & \bm R_{\bm X}\trans
      \end{bmatrix}
      \begin{bmatrix}
        \bm L\trans & \bm R_{\bm Z\bm X}\\
        \bm 0 & \bm R_{\bm X}
      \end{bmatrix}
    \end{displaymath}
  \item The dense matrices $\bm R_{\bm Z\bm X}$ and $\bm R_{\bm X}$
    are stored in the \code{RZX} and \code{RX} slots, respectively.
  \end{itemize}
\end{frame}

\begin{frame}
  \frametitle{Special case of linear mixed models (cont'd)}
  \begin{itemize}
  \item It is not necessary to solve for $\tilde{\bm u}(\bm\theta)$
    and $\widehat{\bm\beta}(\bm\theta)$.  All that is needed for
    evaluation of the profiled log-likelihood is the penalized
    residual sum of squares, $r^2$, and the determinant
    \begin{displaymath}
      |\bm A\bm A\trans+\bm I|=|\bm L|^2
    \end{displaymath}
  \item Because $\bm L$ is triangular, its determinant
    is simply the product of its diagonal elements.
  \item Because $\bm A\bm A\trans + \bm I$ is positive definite, $|\bm
    L|^2>0$.
    
  \item The profiled deviance, as a function of $\bm\theta$ only
    ($\bm\beta$ and $\sigma^2$ at their conditional estimates), is
    \begin{displaymath}
      d(\bm\theta|\bm y)=\log(|\bm L|^2)+
      n\left(1+\log\left(\frac{2\pi r^2}{n}\right)\right)
    \end{displaymath}
  \end{itemize}
\end{frame}

\begin{frame}
  \frametitle{REML results}
  \begin{itemize}
  \item Although not often derived in this form, Laird and Ware showed
    that the REML criterion can be derived as the integral of the
    likelihood w.r.t. $\bm\beta$.
  \item The same techniques as used to evaluate the integral w.r.t.
    $\bm b$ can be used to evaluate the integral for the REML
    criterion.  In this case the integral introduces the factor
    $|\bm R_{\bm X}|^2$.
  \item The profiled REML deviance, as a function of $\bm\theta$ only
    ( $\sigma$ at its conditional estimate), is
    \begin{displaymath}
      d_R(\bm\theta|\bm y)=\log(|\bm L|^2|\bm R_{\bm X}|^2)+(n-p)\left(1+
        \log\left(\frac{2\pi r^2}{n-p}\right)\right)
    \end{displaymath}
  \end{itemize}
\end{frame}

\begin{frame}\frametitle{Recap}
  \begin{itemize}
  \item For a linear mixed model, even one with a huge number of
    observations and random effects like the model for the grade point
    scores, evaluation of the ML or REML profiled deviance, given a
    value of $\bm\theta$, is straightforward.  It involves updating
    $\bm T$ and $\bm S$, then updating $\bm A$,  $\bm L$, $\bm
    R_{\bm Z\bm X}$, $\bm R_{\bm X}$, calculating the penalized
    residual sum of squares, $r$ and a couple of determinants of
    triangular matrices.
  \item The profiled deviance can be optimized as a function of
    $\bm\theta$ only.  The dimension of $\bm\theta$ is usually very
    small.  For the grade point scores there are only three components
    to $\bm\theta$.
  \end{itemize}
\end{frame}

% \begin{frame}\frametitle{Traditional statistical models}
%   \begin{itemize}
%   \item Traditional statistical models are based on a probability
%     distribution for a \Emph{response}, which we can observe. This
%     probability distribution depends on one or more \Emph{parameters}
%     that we wish to estimate.
%   \item The probability distribution can also depend on the values of
%     one or more \Emph{covariates} that are measured in conjunction
%     with the response.  In many statistical models the effect of the
%     covariates is encoded in a \Emph{model matrix} $\bm{X}$
%   \item We will write the random variable representing the responses
%     as $\bm{Y}$, with observed value $\bm{y}=(y_1,\dots,y_n)\trans$.  Our generic
%     parameter vector is $\bm{\theta}$ of length $p$.
%   \item Sometimes the estimate $\widehat{\bm{\theta}}$ of the
%     parameter $\bm{\theta}$ is expressed as a formula.  However, it is
%     often more effective to describe $\widehat{\bm{\theta}}$ by the
%     conditions that it satisfies.  For example, the \Emph{maximum
%       likelihood estimates} of $\bm{\theta}$ are the values that
%     maximize the probability density of $\bm{Y}$ evaluated at the
%     observed data $\bm{y}$.
%   \end{itemize}
% \end{frame}

% \begin{frame}\frametitle{Linear models}
%   \begin{itemize}
%   \item For us, a \Emph{linear model} (LM) prescribes a multivariate normal
%     (or Gaussian) distribution for $\bm{Y}$ with mean
%     $\bm{\mu}_{\bm{Y}}=\bm{X}\bm{\beta}$ and variance-covariance
%     matrix $\mathrm{Var}(\bm{Y})=\sigma^2\bm{I}$.
%     \begin{displaymath}
%       \bm{Y}\sim\mathcal{N}(\bm{X}\bm{\beta}, \sigma^2\bm{I})
%     \end{displaymath}
%   \item The ``effect'' of a particular level of a factor is expressed
%     as an element of $\bm{\beta}$ (or perhaps some linear combination
%     of the elements of $\bm{\beta}$).
%   \item The expression $\bm{\eta}=\bm{X}\bm{\beta}$ is called the \Emph{linear
%       predictor}.  For a linear model 
%     \begin{displaymath}
%       \bm{\mu}_{\bm{Y}}=\bm{\eta}=\bm{X}\bm{\beta}
%     \end{displaymath}
%   \end{itemize}
% \end{frame}

% \begin{frame}\frametitle{Generalized linear models}
%   \begin{itemize}
%   \item In a \Emph{generalized linear model} (GLM) the mean,
%     $\bm{\mu}_{\bm{Y}}$, is a function of the linear predictor, $\bm{\eta}$.
%   \item For historical reasons the map $\bm{g}:
%     \bm{\mu}\rightarrow\bm{\eta}$ is called the \Emph{link} function
%     and the map $\bm{g}^{-1}: \bm{\eta}\rightarrow\bm{\mu}$ is called the
%     \Emph{inverse link}.
%   \item Both $\bm{g}$ and $\bm{g}^{-1}$ are \Emph{diagonal} maps in
%     the sense that the $i$th element of $\bm{\mu}$ depends only on the
%     $i$th element of $\bm{\eta}$ and vice-versa.
%   \item The term ``diagonal map'' reflects the fact that the $n\times
%     n$ Jacobian matrices $d\bm{\eta}/d\bm{\mu}\trans$ and
%     $d\bm{\mu}/d\bm{\eta}\trans$ are both diagonal.
%   \item In a GLM the variance of $\bm{Y}$ can depend on $\bm{\mu}_{\bm{Y}}$
%     but this dependence must also be diagonal.  That is,
%     $\mathrm{Var}(Y_i)$ depends on $\bm{\mu}$ only through $\mu_i$.
%   \item For example, a GLM for a binomial response using the
%     \Emph{logit} link has
%   \end{itemize}
%   \begin{displaymath}
%     \eta_i=\log\frac{\mu_i}{1-\mu_i}, \mu_i=\frac{1}{1+e^{-\eta_i}}
%     \text{ and }\mathrm{Var}(Y_i)=\mu_i(1-\mu_i)
%   \end{displaymath}
% \end{frame}

% \begin{frame}\frametitle{Random effects}
%   \begin{itemize}
%   \item Modeling the effect of a particular level of a factor as a
%     parameter is appropriate when that level is \Emph{reproducible} in
%     that, if we were to repeat the experiment the collection of
%     levels we would observe for the factor would be the same.
%   \item For example we would model the effect of ``treatment'' versus
%     ``control'' or the effect of ``female'' versus ``male'' as parameters.
%   \item On many occasions we wish to incorporate the effect of the
%     \Emph{experimental unit} or \Emph{observational unit} into the
%     model.  Typically if we repeated the experiment we would observe
%     different ``levels'' of these factors.
%   \item We model such effects as \Emph{random effects} and estimate
%     parameters that characterize the population of these effects.
%   \item Even when we observe a complete census of the population,
%     rather than a sample, we model the effects as random effects
%     because we are more interested in the distribution of these
%     ``effects'' than in particular values.
%   \end{itemize}
% \end{frame}

% \begin{frame}\frametitle{Mixed-effects models}
%   \begin{itemize}
%   \item A model that incorporates both fixed-effects parameters,
%     $\bm{\beta}$, and random effects into the linear predictor is called a
%     \Emph{mixed-effects} model.
%   \item The random effects, $\bm{u}$, are the values of a
%     $q$-dimensional random variable $\bm{u}$.  Although we observe the
%     value, $\bm{y}$, of $\bm{Y}$, we do not observe the value, $\bm{u}$,
%     of $\bm{u}$.
%   \item In the models we will consider the distribution of $\bm{u}$ is
%     multivariate normal (or Gaussian) with mean $\bm{0}$ and a
%     patterned variance-covariance matrix.  We will describe the
%     details of this matrix later - for now we state that it can be
%     expressed as a product of a diagonal matrix $\bm{S}$, with
%     positive diagonal elements, and a unit upper-triangular matrix
%     $\bm{T}$.
%   \end{itemize}
% \end{frame}

% \begin{frame}\frametitle{Distribution of B}
%   \begin{itemize}
%   \item For a linear mixed model (LMM)
%     \begin{displaymath}
%       \mathrm{Var}(\bm{u})=\sigma^2\bm{T}\bm{S}\bm{S}\bm{T}\trans
%     \end{displaymath}
%     where $\sigma^2$ is the same scalar as in $\mathrm{Var}(\bm{Y})$.  We
%     call $\sigma$ the \Emph{common scale parameter}.
%   \item Thus
%     \begin{displaymath}
%       \bm{u}\sim\mathcal{N}(\bm{0},\sigma^2\bm{T}\bm{S}\bm{S}\bm{T}\trans)
%     \end{displaymath}
%   \item In GLMMs for which the response is binomial or Poisson, there
%     is no scale common scale parameter.  In these cases
%     \begin{displaymath}
%       \bm{u}\sim\mathcal{N}(\bm{0},\bm{T}\bm{S}\bm{S}\bm{T}\trans)
%     \end{displaymath}
%   \item In many models $\bm{T}$ is the identity, $\bm{T}=\bm{I}_q$, and
%     only the scale parameters in $\bm{S}$ are to be estimated.
%   \item In all cases the number of parameters that determine $\bm{S}$
%     and $\bm{T}$ is much, much smaller than their size, $q$.
%   \end{itemize}
% \end{frame}

% \begin{frame}\frametitle{The orthogonal random effects, U}
%   \begin{itemize}
%   \item It will be convenient to work with
%     $\bm{U}$, a linear transformation of $\bm{u}$ that has
%     the property
%     \begin{displaymath}
%       \bm{U}\sim\mathcal{N}(\bm{0},\sigma^2\bm{I}_q)
%     \end{displaymath}
%     (dropping $\sigma^2$ as appropriate in some GLMMs).
%   \item It is easier to define the transformation from $\bm{U}$ to
%     $\bm{u}$ as
%     \begin{displaymath}
%       \bm{u}=\bm{T}\bm{S}\bm{U}
%     \end{displaymath}
%     This gives the desired distribution
%     $\bm{u}\sim\mathcal{N}(\bm{0},\sigma^2\bm{T}\bm{S}\bm{S}\bm{T}\trans)$.
%   \item When we estimate the parameters that occur on the diagonal of
%     $\bm{S}$ from the observed data, $\bm{y}$, according to the ML or
%     REML criterion it is possible for the estimate to be zero.
%   \item To allow for such cases we allow the diagonal elements of
%     $\bm{S}$ to be non-negative.  We can always express $\bm{u}$ as a
%     function of $\bm{U}$ but the inverse mapping does not exist when
%     any of the diagonal elements of $\bm{S}$ are zero.
%   \end{itemize}
% \end{frame}

% \begin{frame}\frametitle{The conditional mean of Y}
%   \begin{itemize}
%   \item In an LM or GLM we express $\bm{\mu}_{\bm{Y}}$ as a function
%     of the linear predictor, $\bm{\eta}=\bm{X}\bm{\beta}$.
%   \item In an LMM or GLMM it is the \Emph{conditional mean},
%     $\mathrm{E}[\bm{Y}|\bm{u}](\bm{u})$ or
%     $\mathrm{E}[\bm{Y}|\bm{U}](\bm{u})$, that is a function of the
%     linear predictor, $\bm{\eta}=\bm{X}\bm{\beta}+\bm{Z}\bm{u}=
%     \bm{X}\bm{\beta}+\bm{Z}\bm{T}\bm{S}\bm{u}$.  That is,
%     \begin{displaymath}
%       \mathrm{E}[\bm{Y}|\bm{u}](\bm{u})=\bm{\mu}_{\bm{Y}|\bm{u}}(\bm{u})=
%       \bm{g}^{-1}(\bm{X}\bm{\beta}+\bm{Z}\bm{u})
%     \end{displaymath}
%     and
%     \begin{displaymath}
%       \mathrm{E}[\bm{Y}|\bm{U}](\bm{u})=\bm{\mu}_{\bm{Y}|\bm{U}}(\bm{u})=
%       \bm{g}^{-1}(\bm{X}\bm{\beta}+\bm{Z}\bm{T}\bm{S}\bm{u})
%     \end{displaymath}
%     where $\bm{g}^{-1}$ is the (vector) inverse link function for a
%     GLMM.  For a LMM the link is the identity, hence $\bm{g}^{-1}$ is
%     the identity.
%   \end{itemize}
% \end{frame}
