\documentclass{article}
\newcommand{\titel}{Introductory Structural Equation Modeling}
\input{edstyle.tex}

\usepackage{amsmath}
\newcommand{\tr}{\textsf{tr}}
\newcommand{\XX}{\vet{X}^{\prime}\vet{X}}

\newlength{\ldescriptionwidth}
\newcommand{\ldescriptionlabel}[1]{%
  \settowidth{\ldescriptionwidth}{{#1}}%
  \ifdim\ldescriptionwidth>\labelwidth
    {\parbox[b]{\labelwidth}%
      {\makebox[0pt][l]{#1}\\[1pt]\makebox{}}}%
  \else
    \makebox[\labelwidth][l]{{#1}}%
  \fi
  \hfil\relax}
\newenvironment{ldescription}[1][1in]%
  {\begin{list}{}%
    {\setlength{\labelwidth}{#1}%
      \setlength{\leftmargin}{\labelwidth}%
      \addtolength{\leftmargin}{\labelsep}%
      \renewcommand{\makelabel}{\ldescriptionlabel}}}%
  {\end{list}}

\begin{document}
\maketitle\thispagestyle{fancy}\newpage
\tableofcontents\newpage

\subsection*{acknowledgment}
\vspace{1in}
\centering
These slides are based on similar slides by Yves Rosseel.

\newpage

\section{Introduction to SEM}
\subsection{From regression to structural equation modeling}
\subsubsection*{overview}
\begin{itemize}
\item Regression: Predict one observed variable from other observed variables. (correlation)
\item Factor analysis: Do sets of observed variables measure the same unobserved trait? (latent variable)
\item SEM: Predict one latent variable from other latent variables.
\end{itemize}

\newpage
\subsubsection*{univariate linear regression}
\begin{center}
\begin{tikzpicture}[>=stealth,semithick]
% x
\node[ov] (intercept)  {1};
\node[ov] (x1) [below of=intercept] {$x_{1}$};
\node[ov] (x2) [below of=x1]  {$x_{2}$};
\node[ov] (x3) [below of=x2]  {$x_{3}$};
\node[ov] (x4) [below of=x3]  {$x_{4}$};

% y
\begin{scope}[xshift=2cm]
\node[av] (y) at (0,-2) {$y$};
\end{scope}

% epsilon
\begin{scope}[xshift=3cm]
\node[lv] (epsilon) at (0,-1) {$\epsilon$};
\end{scope}

% arrows
\path[->] (intercept) edge node[above,scale=0.6] {$\beta_0$} (y)
          (epsilon) edge node[above,scale=0.6] {} (y)
          (x1) edge node[above,scale=0.6] {$\beta_1$} (y)
          (x2) edge node[above,scale=0.6] {$\beta_2$} (y)
          (x3) edge node[above,scale=0.6] {$\beta_3$} (y)
          (x4) edge node[above,scale=0.6] {$\beta_4$} (y);

\begin{scope}[xshift=5cm]
% x
\node[ov] (x1) at (0,-0.5) {$x_{1}$};
\node[ov] (x2) [below of=x1]  {$x_{2}$};
\node[ov] (x3) [below of=x2]  {$x_{3}$};
\node[ov] (x4) [below of=x3]  {$x_{4}$};

% y
\begin{scope}[xshift=2cm]
\node[av] (y) at (0,-2) {$y$};
\end{scope}

% arrows
\path[->] (x1) edge node[above,scale=0.6] {} (y)
          (x2) edge node[above,scale=0.6] {} (y)
          (x3) edge node[above,scale=0.6] {} (y)
          (x4) edge node[above,scale=0.6] {} (y);
\end{scope}

% curves
%\draw[<->] (x1.west) to [bend right=45] (x2.west);
\end{tikzpicture}
\end{center}
\[
y_i = \beta_0 + \beta_1 x_{i1} + \beta_2 x_{i2} 
                 + \beta_3 x_{i3} + \beta_4 x_{i4} + \epsilon_i
\quad (i=1,2,\ldots,n)
\]
\begin{center}
(squares are observed; circles are latent/unobserved)
\end{center}

\newpage
\subsubsection*{extension: multivariate regression}
\vspace*{0.5cm}
\begin{center}
\begin{tikzpicture}[>=stealth,semithick]
% x
\node[ov] (x1) {$x_{1}$};
\node[ov] (x2) [below of=x1]  {$x_{2}$};
\node[ov] (x3) [below of=x2]  {$x_{3}$};
\node[ov] (x4) [below of=x3]  {$x_{4}$};

% y
\begin{scope}[xshift=2cm]
\node[av] (y1) at (0,-1)      {$y_1$};
\node[av] (y2) [below of=y1]  {$y_2$};
\end{scope}

% arrows
\path[->] (x1) edge node[above,scale=0.6] {} (y1)
          (x2) edge node[above,scale=0.6] {} (y1)
          (x3) edge node[above,scale=0.6] {} (y1)
          (x4) edge node[above,scale=0.6] {} (y1);
\path[->] (x1) edge node[above,scale=0.6] {} (y2)
          (x2) edge node[above,scale=0.6] {} (y2)
          (x3) edge node[above,scale=0.6] {} (y2)
          (x4) edge node[above,scale=0.6] {} (y2);
\end{tikzpicture}
\end{center}

\newpage
\subsubsection*{further extension: path analysis}
\begin{itemize}
  \item testing models of \emph{causal} relationships among observed variables
  \item all variables are observed (manifest)
  \item system of regression equations
\end{itemize}
\vspace*{0.5cm}
\begin{center}
\begin{tikzpicture}[>=stealth,semithick]
% x
\node[ov] (x1)                {$y_1$};
\node[ov] (x2) [below of=x1]  {$y_2$};
\node[ov] (x3) [below of=x2]  {$y_3$};
\node[ov] (x4) [below of=x3]  {$y_4$};

% y
\begin{scope}[xshift=2cm]
\node[av] (x5) at (0,0)    {$y_5$};
\node[av] (x6) at (0,-3)   {$y_6$};
\end{scope}

\begin{scope}[xshift=4cm]
\node[av] (x7) at (0,-3)  {$y_7$};
\end{scope}

\path[->] (x1) edge node[above,scale=0.6] {} (x5)
          (x2) edge node[above,scale=0.6] {} (x5)
          (x3) edge node[above,scale=0.6] {} (x5)
          (x4) edge node[above,scale=0.6] {} (x6)

          (x5) edge node[above,scale=0.6] {} (x6)

          (x6) edge node[above,scale=0.6] {} (x7);
\end{tikzpicture}
\end{center}

\newpage
\sss{exogenous/endogenous}
\begin{itemize}
\item all variables in the model can be classified as {\em exogenous} or {\em endogenous}
\begin{itemize}
\item exogenous: the variable arises outside of the model (latent variable receives no arrows)
\item endogenous: the variable is explained within the model
\item on the previous slide, $y_1$ to $y_4$ are exogenous and the remaining are endogenous
\end{itemize}
\item during SEM estimation, exogenous variables are often handled differently from endogenous variables
\end{itemize}

\newpage
\subsubsection*{latent variables}
\begin{itemize}
\item in the social sciences, observed variables are not without
measurement error
\item single indicator measurement model
\begin{center}
\begin{tikzpicture}[>=stealth,semithick]
\node[ov] (y1) at (0,-1)      {$y$};
\node[lv] (f1) at (1.5, -1)  {$\eta$};
\node[lv,dashed] (error) at (-1.5, -1) {$\epsilon$};

\path[->] (f1) edge node[above,scale=0.6] {} (y1);
\path[->,dashed] (error) edge node[above,scale=0.6] {} (y1);
\end{tikzpicture}
\end{center}
\item multiple indicator measurement model
\begin{center}
\begin{tikzpicture}[>=stealth,semithick]
\node[ov] (y1) at (0,-1)      {$y_1$};
\node[ov] (y2) [below of=y1]  {$y_2$};
\node[ov] (y3) [below of=y2]  {$y_3$};
\node[lv,dashed] (e1) at (-1.5, -1) {$\epsilon_1$};
\node[lv,dashed] (e2) at (-1.5, -2) {$\epsilon_2$};
\node[lv,dashed] (e3) at (-1.5, -3) {$\epsilon_3$};

\node[lv] (f1) at (1.5, -2)  {$\eta$};

\path[->] (f1) edge node[above,scale=0.6] {} (y1)
          (f1) edge node[above,scale=0.6] {} (y2)
          (f1) edge node[above,scale=0.6] {} (y3);
\path[->,dashed] (e1) edge node[above,scale=0.6] {} (y1)
          (e2) edge node[above,scale=0.6] {} (y2)
          (e3) edge node[above,scale=0.6] {} (y3);
\end{tikzpicture}
\end{center}
\end{itemize}

\newpage
\subsubsection*{factor analysis}
\begin{itemize}
\item factor analysis: formally representing the relationship between one or
more latent variables and their (observed) indicators (want 3 indicators per latent)
  \begin{itemize}
    \item confirmatory factor analysis: studying whether observed variables correspond to a specific number of latent variables in a specific arrangement (more common?)
    \item exploratory factor analysis: determining the number of latent variables, as well as which observed variables go with which latent variables (less common?)
  \end{itemize}
\end{itemize}

\newpage
\sss{confirmatory factor analysis (CFA)}
\begin{center}
\begin{tikzpicture}[>=stealth,semithick]
\node[ov] (y1) at (0,-1)      {$y_1$};
\node[ov] (y2) [below of=y1]  {$y_2$};
\node[ov] (y3) [below of=y2]  {$y_3$};
\node[ov] (y4) [below of=y3]  {$y_4$};
\node[ov] (y5) [below of=y4]  {$y_5$};
\node[ov] (y6) [below of=y5]  {$y_6$};

\node[lv] (f1) at (1.5, -2)  {$\eta_1$};
\node[lv] (f2) at (1.5, -5)  {$\eta_2$};

\path[->] (f1) edge node[above,scale=0.6] {} (y1)
          (f1) edge node[above,scale=0.6] {} (y2)
          (f1) edge node[above,scale=0.6] {} (y3)
          (f2) edge node[above,scale=0.6] {} (y4)
          (f2) edge node[above,scale=0.6] {} (y5)
          (f2) edge node[above,scale=0.6] {} (y6);

\path[<->] (f1.east) edge [bend left=45] node[left,scale=0.8] {} (f2.east);
\end{tikzpicture}
\end{center}

\newpage
\sss{exploratory factor analysis (EFA)}
\begin{center}
\begin{tikzpicture}[>=stealth,semithick]
\node[ov] (y1) at (0,-1)      {$y_1$};
\node[ov] (y2) [below of=y1]  {$y_2$};
\node[ov] (y3) [below of=y2]  {$y_3$};
\node[ov] (y4) [below of=y3]  {$y_4$};
\node[ov] (y5) [below of=y4]  {$y_5$};
\node[ov] (y6) [below of=y5]  {$y_6$};

\node[lv] (f1) at (3, -2)  {$\eta_1$};
\node[lv] (f2) at (3, -5)  {$\eta_2$};

\path[->] (f1) edge node[above,scale=0.6] {} (y1)
          (f1) edge node[above,scale=0.6] {} (y2)
          (f1) edge node[above,scale=0.6] {} (y3)
          (f1) edge node[above,scale=0.6] {} (y4)
          (f1) edge node[above,scale=0.6] {} (y5)
          (f1) edge node[above,scale=0.6] {} (y6)
          (f2) edge node[above,scale=0.6] {} (y1)
          (f2) edge node[above,scale=0.6] {} (y2)
          (f2) edge node[above,scale=0.6] {} (y3)
          (f2) edge node[above,scale=0.6] {} (y4)
          (f2) edge node[above,scale=0.6] {} (y5)
          (f2) edge node[above,scale=0.6] {} (y6);

\path[<->] (f1.east) edge [bend left=45] node[left,scale=0.8] {} (f2.east);
\end{tikzpicture}
\end{center}

\newpage
\sss{exploratory factor analysis (EFA)}
\begin{itemize}
\item when we estimate an EFA model, there is not a unique set of best estimates ({\em rotational indeterminacy})
\item this means that we cannot uniquely tell which observed variables ``go with'' which latent variables
\item we first estimate a ``just-identified'' model (details to come) and then apply a {\em rotation} after the estimation. the rotation chooses the set of estimates that is simplest to interpret.
  \begin{itemize}
    \item {\em Orthogonal} rotation: Latent variables (factors) are uncorrelated with one another.
    \item {\em Oblique} rotation: Latent variables are allowed to be correlated with one another (preferred, as orthogonal is a special case)
  \end{itemize}
\end{itemize}

\newpage
\sss{exploratory factor analysis (EFA)}
complicated estimates:
\begin{center}
\begin{tikzpicture}[>=stealth,semithick]
\node[ov] (y1) at (0,-1)      {$y_1$};
\node[ov] (y2) [below of=y1]  {$y_2$};
\node[ov] (y3) [below of=y2]  {$y_3$};
\node[ov] (y4) [below of=y3]  {$y_4$};
\node[ov] (y5) [below of=y4]  {$y_5$};
\node[ov] (y6) [below of=y5]  {$y_6$};

\node[lv] (f1) at (3, -2)  {$\eta_1$};
\node[lv] (f2) at (3, -5)  {$\eta_2$};

\path[->] (f1) edge node[above,scale=0.6] {1.0} (y1)
          (f1) edge node[above,scale=0.6] {.85} (y2)
          (f1) edge node[above,scale=0.6] {1.2} (y3)
          (f1) edge node[above,scale=0.6] {.33} (y4)
          (f1) edge node[above,scale=0.6] {.75} (y5)
          (f1) edge node[above,scale=0.6] {.45} (y6)
          (f2) edge node[above,pos=0.25,scale=0.6] {.75} (y1)
          (f2) edge node[above,pos=0.25,scale=0.6] {1.0} (y2)
          (f2) edge node[above,pos=0.25,scale=0.6] {.93} (y3)
          (f2) edge node[above,pos=0.25,scale=0.6] {.51} (y4)
          (f2) edge node[above,pos=0.25,scale=0.6] {.65} (y5)
          (f2) edge node[above,pos=0.25,scale=0.6] {.94} (y6);

\path[<->] (f1.east) edge [bend left=45] node[left,scale=0.8] {} (f2.east);
\end{tikzpicture}
\end{center}

\newpage
\sss{exploratory factor analysis (EFA)}
simple estimates:
\begin{center}
\begin{tikzpicture}[>=stealth,semithick]
\node[ov] (y1) at (0,-1)      {$y_1$};
\node[ov] (y2) [below of=y1]  {$y_2$};
\node[ov] (y3) [below of=y2]  {$y_3$};
\node[ov] (y4) [below of=y3]  {$y_4$};
\node[ov] (y5) [below of=y4]  {$y_5$};
\node[ov] (y6) [below of=y5]  {$y_6$};

\node[lv] (f1) at (3, -2)  {$\eta_1$};
\node[lv] (f2) at (3, -5)  {$\eta_2$};

\path[->] (f1) edge node[above,scale=0.6] {.93} (y1)
          (f1) edge node[above,scale=0.6] {.74} (y2)
          (f1) edge node[above,scale=0.6] {.84} (y3)
          (f1) edge node[above,scale=0.6] {$\approx 0$} (y4)
          (f1) edge node[above,scale=0.6] {$\approx 0$} (y5)
          (f1) edge node[above,scale=0.6] {$\approx 0$} (y6)
          (f2) edge node[above,pos=0.25,scale=0.6] {$\approx 0$} (y1)
          (f2) edge node[above,pos=0.25,scale=0.6] {$\approx 0$} (y2)
          (f2) edge node[above,pos=0.25,scale=0.6] {$\approx 0$} (y3)
          (f2) edge node[above,pos=0.25,scale=0.6] {1.2} (y4)
          (f2) edge node[above,pos=0.25,scale=0.6] {.89} (y5)
          (f2) edge node[above,pos=0.25,scale=0.6] {1.1} (y6);

\path[<->] (f1.east) edge [bend left=45] node[left,scale=0.8] {} (f2.east);
\end{tikzpicture}
\end{center}

\newpage
\sss{exploratory factor analysis (EFA)}
\begin{itemize}
\item there are hundreds of ways to define ``simplest,'' leading to hundreds of rotation criteria
\item many researchers have a personal preference for a rotation criterion, with little consensus
\item strategy: try the software default and a few others, examining similarities/differences between solutions
\item see the \verb+rotations()+ function from R package GPArotation (used in other packages, like \verb+psych+ and \verb+mirt+)
\end{itemize}

\newpage
\subsubsection*{structural equation modeling (SEM)}
\begin{itemize}
\item path analysis with latent variables
\end{itemize}
\begin{center}
\begin{tikzpicture}[>=stealth,semithick]
\node[ov] (y1) at (0,-1)      {$y_1$};
\node[ov] (y2) [below of=y1]  {$y_2$};
\node[ov] (y3) [below of=y2]  {$y_3$};
\node[ov] (y4) [below of=y3]  {$y_4$};
\node[ov] (y5) [below of=y4]  {$y_5$};
\node[ov] (y6) [below of=y5]  {$y_6$};

\node[lv] (f1) at (1.5, -2)  {$\eta_1$};
\node[lv] (f2) at (1.5, -5)  {$\eta_2$};

\node[ov] (y7)  at (3,0)        {$y_7$};
\node[ov] (y8)  [right of=y7]   {$y_8$};
\node[ov] (y9)  [right of=y8]   {$y_9$};
\node[ov] (y10) [right of=y9]   {$y_{10}$};
\node[ov] (y11) [right of=y10]  {$y_{11}$};
\node[ov] (y12) [right of=y11]  {$y_{12}$};

\node[lv] (f3) at (4, -2) {$\eta_3$};
\node[lv] (f4) at (7, -2) {$\eta_4$};

\path[->] (f1) edge node[above,scale=0.6] {} (y1)
          (f1) edge node[above,scale=0.6] {} (y2)
          (f1) edge node[above,scale=0.6] {} (y3)
          (f2) edge node[above,scale=0.6] {} (y4)
          (f2) edge node[above,scale=0.6] {} (y5)
          (f2) edge node[above,scale=0.6] {} (y6)

          (f3) edge node[above,scale=0.6] {} (y7)
          (f3) edge node[above,scale=0.6] {} (y8)
          (f3) edge node[above,scale=0.6] {} (y9)
          (f4) edge node[above,scale=0.6] {} (y10)
          (f4) edge node[above,scale=0.6] {} (y11)
          (f4) edge node[above,scale=0.6] {} (y12)

          (f1) edge node[above,scale=0.6] {} (f3)
          (f2) edge node[above,scale=0.6] {} (f3)
          (f3) edge node[above,scale=0.6] {} (f4);
\end{tikzpicture}
\end{center}

\newpage
\subsection{The model-implied covariance matrix (the essence of SEM)}
\begin{itemize}
\item the goal of SEM is to test an a priori specified theory (which often
can be depicted as a path diagram)
\item we may have several alternative models, each one with its own path diagram
\item each path diagram can be converted to a SEM:
\begin{itemize}
\item measurement model (relate latent variables to observed indicators)
\item structural equations (regressions among latent/observed variables)
\end{itemize}
\item each diagram has `model-based' implications
\begin{itemize}
\item for the model-implied covariance matrix: $\hat{\vet{\Sigma}}$
\item for the model-implied mean vector: $\hat{\vet{\mu}}$
\item \ldots
\end{itemize}
\item different diagrams lead to (potentially) different implications; 
some implications may provide a bad description of your data
\end{itemize}

\subsubsection*{example model-implied covariance matrix (1)}
\begin{itemize}
\item suppose we have three observed variables, $y_1$, $y_2$ and $y_3$; 
to explain why they are correlated, we may postulate the following model:
\begin{center}
\begin{tikzpicture}[>=stealth,semithick]
% y1
\node[ov] (y1)                {$y_1$};

% y2 and y3
\begin{scope}[xshift=1.5cm]
\node[av] (y2) at (0,0)    {$y_2$};
\node[av] (y3) at (0,-1.5) {$y_3$};
\end{scope}

\path[->] (y1) edge node[above,scale=0.6] {a} (y2)
          (y1) edge node[above,scale=0.6] {b} (y3);
\end{tikzpicture}
\end{center}
\item if we use the following values for the model parameters:
$a=3$ and $b=5$, $\sigma^2(y_1) = 10$, 
$\sigma^2(\epsilon_2) = 20$ and $\sigma^2(\epsilon_3) = 30$, then
we find (see Appendix):
\[
\hat{\vet{\Sigma}} = \left[ \begin{array}{rrr} 
10 & & \\
30 & 110 & \\
50 & 150 & 280 
\end{array}\right]
\]
\end{itemize}

\newpage
\subsubsection*{example model-implied covariance matrix (2)}
\begin{itemize}
\item but if we change the path diagram (and keep the parameter values fixed), 
the model-implied covariance matrix will also change:
\begin{center}
\begin{tikzpicture}[>=stealth,semithick]
% y1
\node[ov] (y1)                {$y_1$};

% y2 and y3
\begin{scope}[xshift=1.5cm]
\node[av] (y2) at (0,0)    {$y_2$};
\node[av] (y3) at (0,-1.5) {$y_3$};
\end{scope}

\path[->] (y1) edge node[above,scale=0.6] {a} (y2)
          (y2) edge node[right,scale=0.6] {b} (y3);
\end{tikzpicture}
\end{center}
we find
\[
\hat{\vet{\Sigma}} = \left[ \begin{array}{rrr} 
10 & & \\
30 & 110 & \\
150 & 550 & 2780
\end{array}\right]
\]
\item two models are said to be {\itshape equivalent}, if they imply the same
covariance matrix (but note that we did not estimate the parameters here)
\end{itemize}

\newpage
\subsubsection*{example model-implied covariance matrix (3)}
\begin{itemize}
\item we can alternatively specify that the correlations
among the three observed variables are explained by a common `factor':
\begin{center}
\begin{tikzpicture}[>=stealth,semithick]
\node[ov] (y1) at (0,-1)      {$y_1$};
\node[ov] (y2) [below of=y1]  {$y_2$};
\node[ov] (y3) [below of=y2]  {$y_3$};

\node[lv] (f1) at (1.5, -2)  {$\eta$};

\path[->] (f1) edge node[above,scale=0.6] {$1$} (y1)
          (f1) edge node[above,scale=0.6] {$a$} (y2)
          (f1) edge node[above,scale=0.6] {$b$} (y3);
\end{tikzpicture}
\end{center}
we find (using $\sigma^2(\epsilon_1) = 10$,
$\sigma^2(\epsilon_2) = 20$, $\sigma^2(\epsilon_3) = 30$, $\sigma^2(\eta) = 1$):
\[
\hat{\vet{\Sigma}} = \left[ \begin{array}{rrr} 
11 & & \\
4 & 36 & \\
5 & 20 & 55
\end{array}\right]
\]
\end{itemize}

\subsection{Matrix representation in a CFA model}
\sss{classic CFA example}
\begin{itemize}
\item well-known dataset based on Holzinger \& Swineford (1939) data
\item also analyzed by J\"{o}reskog (1969), included in {\em lavaan}
\item 9 observed `indicators' measuring three latent factors:
\begin{itemize}
\item a `visual' factor measured by x1, x2 and x3
\item a `textual' factor measured by x4, x5 and x6
\item a `speed' factor measured by x7, x8 and x9
\end{itemize}
\item N=301
\item we assume the three factors are correlated
\end{itemize}

\newpage
\sss{diagram of the model}
\begin{center}
\begin{tikzpicture}[>=stealth,semithick,scale=0.5]

\node[ov] (y1) at (0,0)  {x1};
\node[ov] (y2) at (0,-1.4)  {x2};
\node[ov] (y3) at (0,-2.8)  {x3};
\node[ov] (y4) at (0,-4.2)  {x4};
\node[ov] (y5) at (0,-5.6)  {x5};
\node[ov] (y6) at (0,-7)  {x6};
\node[ov] (y7) at (0,-8.4)  {x7};
\node[ov] (y8) at (0,-9.8)  {x8};
\node[ov] (y9) at (0,-11.2)  {x9};
\node[lv] (f1) at (5, -1.4)  {visual};
\node[lv] (f2) at (5, -5.6)  {textual};
\node[lv] (f3) at (5, -9.8)  {speed};
\path[->] (f1) edge node[above=0.08cm,scale=0.8,pos=0.7] {} (y1.east);
\path[->] (f1) edge node[above=0.08cm,scale=0.8,pos=0.7] {} (y2.east);
\path[->] (f1) edge node[above=0.08cm,scale=0.8,pos=0.7] {} (y3.east);
\path[->] (f2) edge node[above=0.08cm,scale=0.8,pos=0.7] {} (y4.east);
\path[->] (f2) edge node[above=0.08cm,scale=0.8,pos=0.7] {} (y5.east);
\path[->] (f2) edge node[above=0.08cm,scale=0.8,pos=0.7] {} (y6.east);
\path[->] (f3) edge node[above=0.08cm,scale=0.8,pos=0.7] {} (y7.east);
\path[->] (f3) edge node[above=0.08cm,scale=0.8,pos=0.7] {} (y8.east);
\path[->] (f3) edge node[above=0.08cm,scale=0.8,pos=0.7] {} (y9.east);
\path[<->] (f1.east) edge [bend left=45] node[left,scale=0.8] {} (f2.east);
\path[<->] (f1.east) edge [bend left=45] node[left,scale=0.8] {} (f3.east);
\path[<->] (f2.east) edge [bend left=45] node[left,scale=0.8] {} (f3.east);

\end{tikzpicture}
\end{center}

\newpage
\sss{data}
\begin{Sinput}
      x1   x2    x3    x4   x5    x6    x7   x8    x9
1  3.333 7.75 0.375 2.333 5.75 1.286 3.391 5.75 6.361
2  5.333 5.25 2.125 1.667 3.00 1.286 3.783 6.25 7.917
3  4.500 5.25 1.875 1.000 1.75 0.429 3.261 3.90 4.417
4  5.333 7.75 3.000 2.667 4.50 2.429 3.000 5.30 4.861
5  4.833 4.75 0.875 2.667 4.00 2.571 3.696 6.30 5.917
6  5.333 5.00 2.250 1.000 3.00 0.857 4.348 6.65 7.500
7  2.833 6.00 1.000 3.333 6.00 2.857 4.696 6.20 4.861
8  5.667 6.25 1.875 3.667 4.25 1.286 3.391 5.15 3.667
9  4.500 5.75 1.500 2.667 5.75 2.714 4.522 4.65 7.361
10 3.500 5.25 0.750 2.667 5.00 2.571 4.130 4.55 4.361
11 3.667 5.75 2.000 2.000 3.50 1.571 3.739 5.70 4.306
12 5.833 6.00 2.875 2.667 4.50 2.714 3.696 5.15 4.139
13 5.667 4.50 4.125 2.667 4.00 2.286 5.870 5.20 5.861
14 6.000 5.50 1.750 4.667 4.00 1.571 5.130 4.70 4.444
15 5.833 5.75 3.625 5.000 5.50 3.000 4.000 4.35 5.861
16 4.667 4.75 2.375 2.667 4.25 0.714 4.087 3.80 5.139
...
301 4.333 6.00 3.375 3.667 5.75 3.143 4.087 6.95 5.167
\end{Sinput}
\begin{itemize}
\item data are complete (and rounded to 3 decimals above)
\item under normality, the data can be summarized by the covariance matrix
($\mathbf{S}$) and the mean vector ($\mathbf{m}$)
\end{itemize}

\newpage
\sss{observed covariance matrix: \vet{S}}
\begin{itemize}
\item $p$ is the number of observed variables: $p=9$
\item observed covariance matrix (divided by N-1, vs N):
\begin{Sinput}
     x1    x2   x3   x4   x5   x6    x7   x8   x9
x1 1.36
x2 0.41  1.38
x3 0.58  0.45 1.28
x4 0.51  0.21 0.21 1.35
x5 0.44  0.21 0.11 1.10 1.66
x6 0.46  0.25 0.24 0.90 1.01 1.20
x7 0.09 -0.10 0.09 0.22 0.14 0.14  1.18
x8 0.26  0.11 0.21 0.13 0.18 0.17  0.54 1.02
x9 0.46  0.24 0.37 0.24 0.30 0.24  0.37 0.46 1.02
\end{Sinput}
\item we want to `explain' the observed correlations/covariances
via three latent variables (factors) and a
corresponding factor structure
\item we will `rewrite' the $p(p+1)/2 = 45$ elements in the covariance matrix
as a function of a smaller number of `free parameters' in the CFA model,
summarized by a number of (typically sparse) matrices
\end{itemize}

\newpage
\sss{matrix representation}
\begin{itemize}
\item The path diagrams can be formally written out via matrices, with multiple sets of matrices ({\em representations}) available. These representations are different ways of writing the same model.
\item Historically, the representations have corresponded to different pieces of software. Popular representations include ``LISREL'' and ``RAM.''  We will focus on LISREL here.
\end{itemize}


\newpage
\sss{the standard CFA model: matrix representation}
\begin{itemize}
\item the LISREL representation uses three matrices for CFA
\item the LAMBDA matrix contains the `factor structure':
{\small
\[
\vet{\Lambda} = \left[ 
\begin{array}{ccc}
x &0 &0\\
x &0 &0\\
x &0 &0\\
0 &x &0\\
0 &x &0\\
0 &x &0\\
0 &0 &x\\
0 &0 &x\\
0 &0 &x
\end{array} \right]
\]
}
\item the variances/covariances of the latent variables are
summarized in the PSI matrix:
\end{itemize}
{\small
\[
\vet{\Psi} = \left[
\begin{array}{ccc}
x & &\\
x &x &\\
x &x &x
\end{array} \right]
\]
}
\begin{itemize}
\item what we can{\itshape not} explain by the set of common factors
(the `residual part' of the model) is written in the (typically diagonal)
matrix THETA:
{\small
\[
\vet{\Theta} = \left[
\begin{array}{ccccccccc}
x & & & & & & & & \\
 &x & & & & & & & \\
 & &x & & & & & & \\
 & & &x & & & & & \\
 & & & &x & & & & \\
 & & & & &x & & & \\
 & & & & & &x & & \\
 & & & & & & &x & \\
 & & & & & & & &x
\end{array} \right] 
\]
}
\item note that we have only 24 parameters (of which 21 are estimable)
\end{itemize}

\newpage
\sss{the standard CFA model: the model implied covariance matrix}
\begin{itemize}
\item in the standard CFA model, the `implied' covariance matrix
is:
\[ \vet{\Sigma} = \vet{\Lambda} \vet{\Psi} \vet{\Lambda}' + \vet{\Theta} \]
\item all parameters are included in three model matrices
\item simple matrix multiplication (and addition) gives us the
model implied covariance matrix
\item for identification purposes, some parameters need to be fixed to
a constant (typically to 1)
\end{itemize}

\newpage
\sss{setting the metric of the latent variables: UVI or ULI}
\begin{itemize}
\item to identify the model, we need to set the scale/metric of the latent variable
\item example: say that the latent variable is ``verbal ability.'' What are the mean and variance of this unobserved variable?
  \begin{itemize}
  \item the mean and variance require a unit of measurement for verbal ability. Because no units exist here (like fahrenheit or celsius), we must define our own units by setting the mean and variance.
  \item we usually set the mean to 0, with the variance being set in one of two ways
  \end{itemize}
\end{itemize}

\newpage
\sss{setting the metric of the latent variables: UVI or ULI}
\begin{enumerate}
\item {\itshape Unit Loading Identification} (ULI):\\
the factor loading of one (often the first) of the indicators 
is fixed to 1.0; this indicator is called the {\itshape reference} indicator
\item {\itshape Unit Variance Identification} (UVI):\\
the variance of the factor is fixed to 1.0
\end{enumerate}
\begin{center}
\begin{tikzpicture}[>=stealth,semithick]
\node[ov] (y1) at (0,-1)      {$y_1$};
\node[ov] (y2) [below of=y1]  {$y_2$};
\node[ov] (y3) [below of=y2]  {$y_3$};
\node[lv] (f1) at (2, -2)  {$\eta_1$};
\path[->] (f1) edge node[above,scale=0.6] {$1$} (y1)
          (f1) edge node[above,scale=0.6] {$?$} (y2)
          (f1) edge node[above,scale=0.6] {$?$} (y3);

\begin{scope}[xshift=5cm]
\node[ov] (y1) at (0,-1)      {$y_1$};
\node[ov] (y2) [below of=y1]  {$y_2$};
\node[ov] (y3) [below of=y2]  {$y_3$};
\node[lv] (f1) at (2, -2)  {$\eta_1$};
\node (uvi) at (3,-1) {$1.0$};
\path[->] (f1) edge node[above,scale=0.6] {$?$} (y1)
          (f1) edge node[above,scale=0.6] {$?$} (y2)
          (f1) edge node[above,scale=0.6] {$?$} (y3);
\draw[->] (uvi) to (f1);
\end{scope}
\end{tikzpicture}
\end{center}
\begin{itemize}
\item in many models, it does not matter
\item in multigroup SEM analysis, we usually use ULI
\end{itemize}

\newpage
\sss{estimation}
\begin{itemize}
\item estimation problem: choose the `free' parameters, so that the
estimated implied covariance matrix ($\hat{ \vet{\Sigma} }$) is `as close
as possible' to the observed covariance matrix $\vet{S}$
\begin{itemize}
\item maximum likelihood estimation (ML)
\item generalized (weighted) least-squares estimation (GLS, WLS)
\item Bayesian approaches
\end{itemize}
\item this is where we need computers: the models have lots of parameters, and we cannot hope to obtain good parameter values by hand or by intuition
\end{itemize}


\newpage
\sss{observed covariance matrix}
\begin{Sinput}
   x1     x2     x3     x4     x5     x6     x7     x8     x9
x1  1.358
x2  0.407  1.382
x3  0.580  0.451  1.275
x4  0.505  0.209  0.208  1.351
x5  0.441  0.211  0.112  1.098  1.660
x6  0.455  0.248  0.244  0.896  1.015  1.196
x7  0.085 -0.097  0.088  0.220  0.143  0.144  1.183
x8  0.264  0.110  0.212  0.126  0.181  0.165  0.535  1.022
x9  0.458  0.244  0.374  0.243  0.295  0.236  0.373  0.457  1.015
\end{Sinput}

\sss{model-implied covariance matrix}
\begin{Sinput}
   x1    x2    x3    x4    x5    x6    x7    x8    x9
x1 1.358
x2 0.448 1.382
x3 0.590 0.327 1.275
x4 0.408 0.226 0.298 1.351
x5 0.454 0.252 0.331 1.090 1.660
x6 0.378 0.209 0.276 0.907 1.010 1.196
x7 0.262 0.145 0.191 0.173 0.193 0.161 1.183
x8 0.309 0.171 0.226 0.205 0.228 0.190 0.453 1.022
x9 0.284 0.157 0.207 0.188 0.209 0.174 0.415 0.490 1.015
\end{Sinput}

\newpage
\subsection{The implied covariance matrix for the full SEM model}
\begin{itemize}
\item for SEM, the LISREL representation requires
an additional matrix (\vet{B}):
\[ \vet{\Sigma} = \vet{\Lambda} (\vet{I} - \vet{B})^{-1} \vet{\Psi} (\vet{I} - \vet{B})'^{-1} \vet{\Lambda}' + \vet{\Theta} \]
where $\vet{B}$ summarizes the regressions among the latent variables
\item we need this extended model for
\begin{itemize}
\item second-order CFA
\item MIMIC models
\item other models with directional relationships (single-headed arrows) between latent variables
\end{itemize}
\item in LISREL parlance, this is the `all-y' model (other model variants specially handle exogenous variables)
\end{itemize}

\newpage
\sss{SEM example: Political Democracy}
\begin{itemize}
\item Industrialization and Political Democracy dataset (N=75)
\item This dataset is used throughout Bollen's 1989 book (see pages 12,
     17, 36 in chapter 2, pages 228 and following in chapter 7, pages
     321 and following in chapter 8).
\item The dataset contains various
     measures of political democracy and industrialization in
     developing countries:
\begin{Sinput}
     y1: Expert ratings of the freedom of the press in 1960
     y2: The freedom of political opposition in 1960
     y3: The fairness of elections in 1960
     y4: The effectiveness of the elected legislature in 1960
     y5: Expert ratings of the freedom of the press in 1965
     y6: The freedom of political opposition in 1965
     y7: The fairness of elections in 1965
     y8: The effectiveness of the elected legislature in 1965
     x1: The gross national product (GNP) per capita in 1960
     x2: The inanimate energy consumption per capita in 1960
     x3: The percentage of the labor force in industry in 1960
\end{Sinput}
\end{itemize}

\newpage
\sss{model diagram}
\begin{center}
\begin{tikzpicture}[>=stealth,semithick,scale=0.6]
\node[ov] (y1) at (0,0)     {\code{y1}};
\node[ov] (y2) at (0,-1.4)  {\code{y2}};
\node[ov] (y3) at (0,-2.8)  {\code{y3}};
\node[ov] (y4) at (0,-4.2)  {\code{y4}};
\node[ov] (y5) at (0,-5.6)  {\code{y5}};
\node[ov] (y6) at (0,-7)    {\code{y6}};
\node[ov] (y7) at (0,-8.4)  {\code{y7}};
\node[ov] (y8) at (0,-9.8)  {\code{y8}};
\node[ov] (x1) at ( 6,0)     {\code{x1}};
\node[ov] (x2) at ( 8,0)     {\code{x2}};
\node[ov] (x3) at (10,0)     {\code{x3}};
\node[lv] (f1) at (4, -2.8) {\code{dem60}};
\node[lv] (f2) at (4, -7.6) {\code{dem65}};
\node[lv] (f3) at (8, -2.8) {\code{ind60}};
\path[->] (f1) edge node[above=0.08cm,scale=0.8,pos=0.7] {} (y1.east);
\path[->] (f1) edge node[above=0.08cm,scale=0.8,pos=0.7] {} (y2.east);
\path[->] (f1) edge node[above=0.08cm,scale=0.8,pos=0.7] {} (y3.east);
\path[->] (f1) edge node[above=0.08cm,scale=0.8,pos=0.7] {} (y4.east);
\path[->] (f2) edge node[above=0.08cm,scale=0.8,pos=0.7] {} (y5.east);
\path[->] (f2) edge node[above=0.08cm,scale=0.8,pos=0.7] {} (y6.east);
\path[->] (f2) edge node[above=0.08cm,scale=0.8,pos=0.7] {} (y7.east);
\path[->] (f2) edge node[above=0.08cm,scale=0.8,pos=0.7] {} (y8.east);
\path[->] (f3) edge node[above=0.08cm,scale=0.8,pos=0.7] {} (x1.south);
\path[->] (f3) edge node[above=0.08cm,scale=0.8,pos=0.7] {} (x2.south);
\path[->] (f3) edge node[above=0.08cm,scale=0.8,pos=0.7] {} (x3.south);
\path[->] (f1) edge node[above=0.08cm,scale=0.8,pos=0.7] {} (f2);
\path[->] (f3) edge node[above=0.08cm,scale=0.8,pos=0.7] {} (f1.east);
\path[->] (f3) edge node[above=0.08cm,scale=0.8,pos=0.7] {} (f2.north east);
\path[<->] (y1.west) edge [bend right=45] node[left,scale=0.8] {} (y5.west);
\path[<->] (y2.west) edge [bend right=45] node[left,scale=0.8] {} (y6.west);
\path[<->] (y3.west) edge [bend right=45] node[left,scale=0.8] {} (y7.west);
\path[<->] (y4.west) edge [bend right=45] node[left,scale=0.8] {} (y8.west);
\path[<->] (y2.south west) edge [bend right=45] node[left,scale=0.8] {} (y4.north west);
\path[<->] (y6.south west) edge [bend right=45] node[left,scale=0.8] {} (y8.north west);
\end{tikzpicture}
\end{center}

\newpage
\sss{selection of the output}
\begin{Routput}
                   Estimate  Std.err  Z-value  P(>|z|)   Std.lv  Std.all
Latent variables:
  ind60 =~
    x1                1.000                               0.670    0.920
    x2                2.180    0.139   15.742    0.000    1.460    0.973
    x3                1.819    0.152   11.967    0.000    1.218    0.872
  dem60 =~
    y1                1.000                               2.223    0.850
    y2                1.257    0.182    6.889    0.000    2.794    0.717
    y3                1.058    0.151    6.987    0.000    2.351    0.722
    y4                1.265    0.145    8.722    0.000    2.812    0.846
  dem65 =~
    y5                1.000                               2.103    0.808
    y6                1.186    0.169    7.024    0.000    2.493    0.746
    y7                1.280    0.160    8.002    0.000    2.691    0.824
    y8                1.266    0.158    8.007    0.000    2.662    0.828

Regressions:
  dem60 ~
    ind60             1.483    0.399    3.715    0.000    0.447    0.447
  dem65 ~
    ind60             0.572    0.221    2.586    0.010    0.182    0.182
    dem60             0.837    0.098    8.514    0.000    0.885    0.885
...
\end{Routput}

\newpage
\subsection{Model parameters and model matrices}
\sss{31 `free' model parameters}
\begin{Sinput}
> coef(fit)
\end{Sinput}
\begin{Routput}
   ind60=~x2    ind60=~x3    dem60=~y2    dem60=~y3    dem60=~y4    dem65=~y6 
       2.180        1.819        1.257        1.058        1.265        1.186 
   dem65=~y7    dem65=~y8  dem60~ind60  dem65~ind60  dem65~dem60       y1~~y5 
       1.280        1.266        1.483        0.572        0.837        0.624 
      y2~~y4       y2~~y6       y3~~y7       y4~~y8       y6~~y8       x1~~x1 
       1.313        2.153        0.795        0.348        1.356        0.082 
      x2~~x2       x3~~x3       y1~~y1       y2~~y2       y3~~y3       y4~~y4 
       0.120        0.467        1.891        7.373        5.067        3.148 
      y5~~y5       y6~~y6       y7~~y7       y8~~y8 ind60~~ind60 dem60~~dem60 
       2.351        4.954        3.431        3.254        0.448        3.956 
dem65~~dem65 
       0.172
\end{Routput}

\newpage
\sss{model matrices: free parameters}
\begin{Sinput}
> inspect(fit)
\end{Sinput}
\begin{Routput}
$lambda
   ind60 dem60 dem65
x1     0     0     0
x2     1     0     0
x3     2     0     0
y1     0     0     0
y2     0     3     0
y3     0     4     0
y4     0     5     0
y5     0     0     0
y6     0     0     6
y7     0     0     7
y8     0     0     8
\end{Routput}

\newpage
\begin{Routput}
$theta
   x1 x2 x3 y1 y2 y3 y4 y5 y6 y7 y8
x1 18                              
x2  0 19                           
x3  0  0 20                        
y1  0  0  0 21                     
y2  0  0  0  0 22                  
y3  0  0  0  0  0 23               
y4  0  0  0  0 13  0 24            
y5  0  0  0 12  0  0  0 25         
y6  0  0  0  0 14  0  0  0 26      
y7  0  0  0  0  0 15  0  0  0 27   
y8  0  0  0  0  0  0 16  0 17  0 28

$psi
      ind60 dem60 dem65
ind60 29               
dem60  0    30         
dem65  0     0    31   

$beta
      ind60 dem60 dem65
ind60     0     0     0
dem60     9     0     0
dem65    10    11     0
\end{Routput}

\newpage
\sss{model matrices: estimated values}
\begin{Sinput}
> inspect(fit, "est")
\end{Sinput}
\begin{Routput}
$lambda                                                                         
   ind60 dem60 dem65
x1 1.000 0.000 0.000                                                            
x2 2.180 0.000 0.000
x3 1.819 0.000 0.000
y1 0.000 1.000 0.000                                                            
y2 0.000 1.257 0.000
y3 0.000 1.058 0.000
y4 0.000 1.265 0.000                                                            
y5 0.000 0.000 1.000
y6 0.000 0.000 1.186
y7 0.000 0.000 1.280                                                            
y8 0.000 0.000 1.266

$theta
   x1    x2    x3    y1    y2    y3    y4    y5    y6    y7    y8   
x1 0.082                                                            
x2 0.000 0.120                                                      
x3 0.000 0.000 0.467                                                
y1 0.000 0.000 0.000 1.891                                          
y2 0.000 0.000 0.000 0.000 7.373                                    
y3 0.000 0.000 0.000 0.000 0.000 5.067                              
y4 0.000 0.000 0.000 0.000 1.313 0.000 3.148                        
y5 0.000 0.000 0.000 0.624 0.000 0.000 0.000 2.351                  
y6 0.000 0.000 0.000 0.000 2.153 0.000 0.000 0.000 4.954            
y7 0.000 0.000 0.000 0.000 0.000 0.795 0.000 0.000 0.000 3.431      
y8 0.000 0.000 0.000 0.000 0.000 0.000 0.348 0.000 1.356 0.000 3.254

$psi
      ind60 dem60 dem65
ind60 0.448            
dem60 0.000 3.956      
dem65 0.000 0.000 0.172

$beta
      ind60 dem60 dem65
ind60 0.000 0.000     0
dem60 1.483 0.000     0
dem65 0.572 0.837     0
\end{Routput}

\newpage
\sss{manually computing the model-implied covariance matrix (optional)}
\begin{Sinput}
# make the model matrices available in R's workspace
attach(inspect(fit, "est"))

# compute (I - B)^(-1)
IB <- diag(nrow(beta)) - beta
IB.inv <- solve(IB)

# compute the model-implied model matrix (using formula on slide 24)
Sigma.hat <- lambda %*% IB.inv %*% psi %*% t(IB.inv) %*% t(lambda) + theta

# print the matrix
round(Sigma.hat, 3)
\end{Sinput}
\begin{Routput}
      x1    x2    x3    y1     y2     y3     y4    y5     y6     y7     y8
x1 0.530 0.978 0.815 0.665  0.836  0.703  0.841 0.814  0.965  1.041  1.030
x2 0.978 2.252 1.778 1.450  1.822  1.534  1.834 1.774  2.103  2.270  2.245
x3 0.815 1.778 1.950 1.209  1.520  1.279  1.530 1.479  1.754  1.893  1.873
y1 0.665 1.450 1.209 6.834  6.211  5.228  6.251 5.143  5.358  5.782  5.721
y2 0.836 1.822 1.520 6.211 15.179  6.570  9.169 5.679  8.887  7.267  7.190
y3 0.703 1.534 1.279 5.228  6.570 10.597  6.612 4.780  5.667  6.911  6.051
y4 0.841 1.834 1.530 6.251  9.169  6.612 11.054 5.716  6.777  7.313  7.584
y5 0.814 1.774 1.479 5.143  5.679  4.780  5.716 6.773  5.243  5.658  5.598
y6 0.965 2.103 1.754 5.358  8.887  5.667  6.777 5.243 11.171  6.709  7.994
y7 1.041 2.270 1.893 5.782  7.267  6.911  7.313 5.658  6.709 10.671  7.163
y8 1.030 2.245 1.873 5.721  7.190  6.051  7.584 5.598  7.994  7.163 10.341
\end{Routput}

\newpage
\subsection{Model estimation}
\begin{itemize}
\item we seek those values for $\vet{\theta}$ that minimize the difference
between what we observe in the data, $\vet{S}$, and what the model
implies, $\vet{\Sigma}(\vet{\theta})$
\item the final estimated values are denoted by $\hat{\vet{\theta}}$, and
the estimated model-implied covariance matrix can be written as
$\hat{\vet{\Sigma}} = \vet{\Sigma}(\hat{\vet{\theta}})$
\item there are many ways to quantify this `difference', leading to different
discrepancy measures
\end{itemize}

\newpage
\sss{Model estimation}
\begin{itemize}
\item the most popular discrepancy measure is based on maximum likelihood:
\[ F_{ML}(\vet{\theta}) = \log |\vet{\Sigma}| + \tr(\vet{S} \vet{\Sigma}^{-1}) - 
                \log |\vet{S}| - p
\]
\item in practice, we replace $\vet{\Sigma}$ by $\hat{\vet{\Sigma}} = \vet{\Sigma}(\hat{\vet{\theta}})$
\item an alternative is (weighted) least squares, for some weight matrix \vet{W}:
\[ F_{WLS}(\vet{\theta}) = (\vet{s} - \vet{\sigma})'\vet{W}^{-1}(\vet{s} - \vet{\sigma}) \]
where $\vet{s}$ and $\vet{\sigma}$ are the unique elements of $\vet{S}$ and
$\vet{\Sigma}$ respectively
\end{itemize}


\newpage
\subsection{Model evaluation}
\sss{evaluation of global fit -- chi-square test statistic}
\begin{itemize}
\item the chi-square test statistic is the primary test of our model. this statistic can usually be obtained regardless of discrepancy measure.
\item if the chi-square test statistic is NOT significant, we have a good
fit of the model
\item roughly, H0: the model fits the data; H1: the model does not fit the data
\item non-significant chi-squares become increasingly difficult as the sample size grows
\end{itemize}

\sss{evaluation of global fit -- fit indices}
\begin{itemize}
\item (some) rules of thumb: CFI/TLI $> 0.95$, RMSEA $< 0.05$, SRMR $< 0.06$
\item there is a lot of controversy about the use (and misuse) of these
fit indices
\item a classic reference here is Hu \& Bentler (1999)
\end{itemize}

\newpage
\sss{admissibility of the results}
\begin{itemize}
\item are the parameter values valid? Often a sign of a bad-fitting model
\begin{itemize}
\item negative (residual) variances
\item correlations larger than one
\end{itemize}
\item do the regression coefficients, factor loadings, covariances
 have the expected sign (positive or negative)?
\item are all free parameters significant?
\item are there any excessively large standard errors?
\end{itemize}

\newpage
\subsection{Model respecification/comparison}
\begin{itemize}
\item if the fit of a model is not good, we can adapt (respecify) the
model
\begin{itemize}
\item change the number of factors
\item allow for indicators to be related to more than one factor (cross-loadings)
\item allow for correlated residual errors among the observed indicators
\item allow for correlated disturbances among the endogenous latent
variables
\item remove problematic indicators
\ldots
\end{itemize}
\item ideally, all changes should have a sound theoretical justification
\item this is a place where people get into trouble: if we continually change the model until it fits, then results are less likely to generalize/replicate
\end{itemize}

\newpage
\sss{comparison of models}
\begin{itemize}
\item we can also compare two models to one another (compare alternate theories with one another), using statistics similar to those used for global fit evaluation
\item comparisons are easier if one model is {\em nested} within the other
\begin{itemize}
\item roughly, model A is nested within model B if it is a special case of model B (i.e., model B can predict everything that model A can predict and more)
\item model A is often called the ``reduced'' model, with model B being the ``full'' model
\item model B will always fit the observed data better than model A
\item nesting is often, but not always, evident from path diagrams
\end{itemize}
\end{itemize}

\newpage
\sss{comparison of models -- nested}
\begin{itemize}
\item when models are nested, we can compare them via a chi-square difference test (also called ``likelihood ratio test'')
\begin{itemize}
\item H0: model A is as good as model B (therefore, prefer model A because it is simpler)
\item H1: model A is not as good as model B
\item the chi-square statistic is the difference between the models' global chi-squares, with degrees of freedom being the corresponding difference in global degrees of freedom
\end{itemize}
\end{itemize}

\newpage
\sss{comparison of models -- non-nested}
\begin{itemize}
\item when models are not nested, we typically compare them via AIC or BIC
\item each model receives a criterion value, and the model with the lowest value is deemed ``best''
\item differences between fit indices are also sometimes considered, though there are no strict results about what constitutes a small/large difference
\item Merkle, You, \& Preacher (2016) implemented a chi-square test of non-nested models that works similarly to the nested test, available via package {\em nonnest2}
\end{itemize}

\newpage
\subsection{Bayesian SEM}
\begin{itemize}
\item the model estimation methods considered so far all converge to a point; they seek the parameter values that best reproduce the observed covariance matrix (and possibly mean vector)
\item alternatively, we can use Bayesian methods to estimate the {\em posterior distribution} of model parameters (not point estimates; distributional estimates)
\end{itemize}

\newpage
\sss{Bayesian SEM}
\begin{itemize}
\item idea of Bayesian methods
  \begin{itemize}
  \item start with prior beliefs (distributions) about model parameters
  \item observe data
  \item update prior beliefs with the data, leading to posterior beliefs (distributions)
  \end{itemize}
\item advantages: easier to interpret intervals; fewer asymptotic arguments are needed; easier to estimate some complicated models
\end{itemize}

\newpage
\sss{Bayesian SEM}
\begin{itemize}
\item idea of Bayesian estimation
  \begin{itemize}
  \item instead of finding the ``best'' estimates, we are looking for the posterior distribution of estimates
  \item this is typically accomplished by drawing random samples from the posterior distribution via {\em Markov chain Monte Carlo}
  \item once we draw thousands of posterior samples, we can summarize them by computing means, standard deviations, etc.
  \end{itemize}
\end{itemize}

\newpage
\sss{Bayesian SEM}
\begin{itemize}
\item software for Bayesian SEM
  \begin{itemize}
  \item flexible (but sometimes difficult) model specification: BUGS, JAGS, Stan
  \item easier, less flexible model specification: Mplus (stand alone), blavaan (translate from lavaan to JAGS or Stan, then convert results back to lavaan)
  \end{itemize}
\end{itemize}

\newpage
\subsection{Reporting results}
\begin{itemize}
\item see Boomsma (2000)
\item report enough information so that the analysis can be replicated
\begin{itemize}
\item always report the observed covariance matrix (or the correlation matrix +
standard deviations)
\item better to include the full dataset (either as an electronic
appendix or via a website)
\end{itemize}
\end{itemize}

\newpage
\subsection{Further reading}
Kline, R. B. (2015). Principles and practice of structural equation modeling
(Fourth Edition). New York: Guilford Press.
\begin{quote}
{\small \itshape \ldots 
The companion website supplies data, syntax, and output for the book's examples--now including files for Amos, EQS, LISREL, Mplus, Stata, and R (lavaan).}
\end{quote}

\noindent
Brown, T. A. (2015). Confirmatory Factor Analysis for Applied Research (Second Edition) New York: Guilford Press.\\

\noindent
Bollen, K.A. (1989). Structural equations with latent variables. New York:
Wiley.\\

\noindent
Hancock, G. R., \& Mueller, R. O. (Eds.). (2013). Structural equation modeling:
A second course (Second Edition). Greenwich, CT: Information Age Publishing, Inc.\\

\noindent
Boomsma, A. (2000). Reporting Analyses of Covariance Structures.
{\itshape Structural Equation Modeling: A Multidisciplinary Journal, 7},
461--483.

\newpage
\sss{SEM in R, using lavaan}
\noindent
Beaujean, A. A. (2014). Latent variable modeling using R: A step-by-step guide. Routledge.\\

\noindent
Finch, W.H., and French, B.F.\ (2015). Latent Variable Modeling with R. Routledge.\\

\noindent Little, T.D.\ (2013). Longitudinal Structural Equation Modeling (Methodology in the Social Sciences). The Guilford Press.


\newpage
\section{Advanced topics}
\subsection{Meanstructures}
\begin{itemize}
\item traditionally, SEM has focused on covariance structure analysis, but we can also include the means (fitting only the covariance matrix, vs fitting both the covariance matrix and means)
\item typical situations where we would include the means are:
\begin{itemize}
\item multiple group analysis
\item growth curve models
\item analysis of non-normal data, and/or missing data
\end{itemize}
\end{itemize}

\newpage
\sss{adding the means}
\begin{itemize}
\item we have more data: the $p$-dimensional mean vector (if we have raw data, we will always have this)
\item we have more parameters:
\begin{itemize}
\item means/intercepts for the observed variables
\item means/intercepts for the latent variables (often fixed to zero)
\end{itemize}
\end{itemize}

\newpage
\sss{adding the means}
\begin{itemize}
\item if no restrictions are imposed on the means, the fit will be
identical to the non-meanstructure fit
\item we add $p$ datapoints (the mean vector)
\item we add $p$ free parameters (the intercepts of the observed variables)
\item we fix the latent means to zero
\item the number of degrees of freedom does not change
\end{itemize}

\newpage
\subsection{Multiple groups}
\sss{single group analysis (CFA)}
\begin{center}
\begin{tikzpicture}[>=stealth,semithick]
\node[ov] (y1) at (0,-1)      {$y_1$};
\node[ov] (y2) [below of=y1]  {$y_2$};
\node[ov] (y3) [below of=y2]  {$y_3$};
\node[ov] (y4) [below of=y3]  {$y_4$};
\node[ov] (y5) [below of=y4]  {$y_5$};
\node[ov] (y6) [below of=y5]  {$y_6$};

\node[lv] (f1) at (1.5, -2)  {$f_1$};
\node[lv] (f2) at (1.5, -5)  {$f_2$};

\path[->] (f1) edge node[above,scale=0.6] {} (y1)
          (f1) edge node[above,scale=0.6] {} (y2)
          (f1) edge node[above,scale=0.6] {} (y3)
          (f2) edge node[above,scale=0.6] {} (y4)
          (f2) edge node[above,scale=0.6] {} (y5)
          (f2) edge node[above,scale=0.6] {} (y6);

\path[<->] (f1.east) edge [bend left=45] node[left,scale=0.8] {} (f2.east);
\end{tikzpicture}
\end{center}
\begin{itemize}
\item factor means typically fixed to zero
\end{itemize}



\newpage
\sss{multiple group analysis (CFA)}
\begin{center}
GROUP 1 \hspace{4cm} GROUP 2\\*[0.4cm]
\begin{tikzpicture}[>=stealth,semithick]
\node[ov] (y1) at (0,-1)      {$y_1$};
\node[ov] (y2) [below of=y1]  {$y_2$};
\node[ov] (y3) [below of=y2]  {$y_3$};
\node[ov] (y4) [below of=y3]  {$y_4$};
\node[ov] (y5) [below of=y4]  {$y_5$};
\node[ov] (y6) [below of=y5]  {$y_6$};

\node[lv] (f1) at (1.5, -2)  {$f_1$};
\node[lv] (f2) at (1.5, -5)  {$f_2$};

\path[->] (f1) edge node[above,scale=0.6] {} (y1)
          (f1) edge node[above,scale=0.6] {} (y2)
          (f1) edge node[above,scale=0.6] {} (y3)
          (f2) edge node[above,scale=0.6] {} (y4)
          (f2) edge node[above,scale=0.6] {} (y5)
          (f2) edge node[above,scale=0.6] {} (y6);

\path[<->] (f1.east) edge [bend left=45] node[left,scale=0.8] {} (f2.east);
\end{tikzpicture}
\hspace{1cm}
\begin{tikzpicture}[>=stealth,semithick]
\node[ov] (y1) at (0,-1)      {$y_1$};
\node[ov] (y2) [below of=y1]  {$y_2$};
\node[ov] (y3) [below of=y2]  {$y_3$};
\node[ov] (y4) [below of=y3]  {$y_4$};
\node[ov] (y5) [below of=y4]  {$y_5$};
\node[ov] (y6) [below of=y5]  {$y_6$};

\node[lv] (f1) at (1.5, -2)  {$f_1$};
\node[lv] (f2) at (1.5, -5)  {$f_2$};

\path[->] (f1) edge node[above,scale=0.6] {} (y1)
          (f1) edge node[above,scale=0.6] {} (y2)
          (f1) edge node[above,scale=0.6] {} (y3)
          (f2) edge node[above,scale=0.6] {} (y4)
          (f2) edge node[above,scale=0.6] {} (y5)
          (f2) edge node[above,scale=0.6] {} (y6);

\path[<->] (f1.east) edge [bend left=45] node[left,scale=0.8] {} (f2.east);
\end{tikzpicture}
\end{center}
\begin{itemize}
\item we can potentially compare the means of the latent variables
\end{itemize}

\subsection{Measurement invariance}
\begin{itemize}
\item latent variable means get at interesting questions; we want to know whether the ``true'' trait of interest varies, as opposed to the observed means that are influenced by noisy measurement
\item we can only compare the means of the latent variables across
groups if `measurement invariance' across groups has been established
\item example: students complain that a fourth-grade test is biased, favoring girls over boys. In support of the students' complaint, the average score for girls was 5 points higher than the average score for boys.
\end{itemize}

\newpage
\begin{itemize}
\item we can consider two possibilities here:
\begin{itemize}
\item the test is not biased; boys in the class just have lower ability (= mean of latent variable) than girls. ({\em measurement invariance is satisfied})
\item the test is biased; a boy and girl with the same level of ability would systematically receive different scores on the test. ({\em bias/lack of invariance})
\end{itemize}
\item if we could get everyone to take a second test that we knew to be unbiased, we could begin to distinguish between these possibilities
\end{itemize}

\newpage
\begin{itemize}
\item formal testing for measurement invariance involves a fixed sequence of
model comparison tests
\item one typical sequence involves 3 steps:
\begin{enumerate}
\item Model 1: configural invariance. The same model/factor structure is
          imposed on all groups.
\item Model 2: weak invariance. The factor loadings are constrained
          to be equal across groups.
\item Model 3: strong invariance. The factor loadings and
          intercepts are constrained to be equal across groups.
\end{enumerate}
\item other sequences involve more steps; for example `strict invariance'
implies constraining the residual variances too
\item model comparison tests: compare the current model with the
     previous one (either using a chi-square difference test or looking
     at other fit measures)
\item {\itshape partial} measurement invariance: most but not all
parameters are equivalent across groups. (i.e., two tests are invariant but one is not)
\item references:
{\small
\begin{itemize}
\item Vandenberg, R.J. and Lance, C.E. (2000). A Review and Synthesis of
the Measurement Invariance Literature: Suggestions, Practices, and
Recommendations for Organizational Research. {\itshape Organizational
Research Methods, 3}, 4--69.
\item Cheung, G.W., and Rensvold, R.B. (2000). Evaluating goodness-of-fit
indices for testing measurement invariance. {\itshape Structural Equation
Modeling, 9}, 233-255.
\item Byrne, B.M., Shavelson, R.J and Muth\'{e}n, B. (1989). Testing for
the equivalence of factor covariance and mean structures: The issue of
partial measurement invariance. {\itshape Psychological Bulletin, 105},
456-466.
\end{itemize}
}
\end{itemize}

\newpage
\sss{measurement invariance tests -- all together}
\begin{Sinput}
> library(semTools)
> measurementInvariance(HS.model, data = HolzingerSwineford1939,
                        group = "school", strict = FALSE)
\end{Sinput}
\begin{Routput}
Measurement invariance models:

Model 1 : fit.configural
Model 2 : fit.loadings
Model 3 : fit.intercepts
Model 4 : fit.means

Chi Square Difference Test

               Df    AIC    BIC  Chisq Chisq diff Df diff Pr(>Chisq)    
fit.configural 48 7484.4 7706.8 115.85                                  
fit.loadings   54 7480.6 7680.8 124.04      8.192       6     0.2244    
fit.intercepts 60 7508.6 7686.6 164.10     40.059       6  4.435e-07 ***
fit.means      63 7543.1 7710.0 204.61     40.502       3  8.338e-09 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1







Fit measures:

                 cfi rmsea cfi.delta rmsea.delta
fit.configural 0.923 0.097        NA          NA
fit.loadings   0.921 0.093     0.002       0.004
fit.intercepts 0.882 0.107     0.038       0.015
fit.means      0.840 0.122     0.042       0.015
\end{Routput}


\newpage
\subsection{Missing data}
\sss{missing data}
\begin{itemize}
\item missing data are especially problematic in SEM because each person supplies us with many variables
\item if a person is missing one variable, we don't want to throw out his/her other, observed variables
\item Rubin defines three missing data mechanisms that provide guidance for how to handle the missing data
\end{itemize}

\newpage
\sss{missing data mechanisms}
\begin{itemize}
\item MCAR: missing completely at random
\begin{itemize}
\item listwise deletion is ok (data are lost, but the estimates are 
still unbiased)
\end{itemize}
\item MAR: missing at random
\begin{itemize}
\item what caused the data to be missing does not depend upon the
missing data itself, but may depend on the non-missing data
\item listwise deletion is NOT ok: estimates are biased
\item alternatives: full information ML (FIML), multiple imputation, \ldots
\end{itemize}
\item MNAR: not missing at random
\begin{itemize}
\item in general, almost all standard statistical methods are no longer valid
\item we can only try to understand the missingness mechanism at hand, and
take this into account when modeling the data
\end{itemize}
\end{itemize}

\newpage
\sss{missing data examples}
\begin{itemize}
\item examples of missingness mechanisms, using a high school reading test (Collins, Schafer, \& Kam, 2001)
  \begin{itemize}
  \item MCAR: some students miss the test due to drivers' education class. this is a ``completely random'' set of missing students, because ``drivers' education class'' is unrelated to reading ability.
  \item MAR: special education students are more likely to be absent for the test, as compared to other students. data are MAR {\em if} we include ``student status'' (special education/not special education) as an additional variable in our analysis.
  \item MNAR: students with lower reading ability skip the test day more than other students. if we have no other information about these absent students, then data are MNAR.
  \item We can sometimes move from MNAR to MAR by including extra {\em auxiliary variables} thought to explain missingness (esp relevant to multiple imputation)
  \end{itemize}
\end{itemize}

\newpage
\subsection{Nonnormal data and alternative estimators}
\sss{what if the data are NOT normally distributed?}
\begin{itemize}
\item in the real world, data may never be normally distributed
\item two types:
\begin{itemize}
\item categorical and/or limited-dependent outcomes: binary, ordinal, nominal,
counts, censored (WLSMV, logit/probit)
\item continuous outcomes, not normally distributed: skewed,
too flat/too peaked (kurtosis), \ldots
\end{itemize}
\item three strategies to deal with continuous non-normal data
\begin{enumerate}
\item asymptotically distribution-free estimation
\item ML estimation with `robust' standard errors, and a `robust' test statistic
for model evaluation
\item bootstrapping
\end{enumerate}
\end{itemize}

\newpage
\sss{robust method 1: asymptotically distribution-free (ADF) estimation}
\begin{itemize}
\item the ADF estimator (Browne, 1984) makes no assumption of normality and 
is part of a larger family of estimators called 
weighted least squares (WLS) estimators:
\[ F_{WLS} = (\mathbf{s} - \hat{\mbox{\boldmath$\sigma$}})^\top \mathbf{W}^{-1}
       (\mathbf{s} - \hat{\mbox{\boldmath$\sigma$}})
\]
where $\mathbf{s}$ and $\hat{\mbox{\boldmath$\sigma$}}$ are vectors containing
 the non-duplicated elements in the sample ($\mathbf{S}$) and 
model-implied ($\hat{\vet{\Sigma}}$) covariance matrix respectively
\item the weight matrix $\mathbf{W}$ utilized with the ADF estimator is the
asymptotic covariance matrix: a matrix of the covariances of the observed
sample variances and covariances
\item unfortunately, empirical research has shown that the ADF method breaks
down unless the sample size is huge (e.g., N $> 5000$)
\item in lavaan:
\begin{Sinput}
fit <- cfa(HS.model, data = HolzingerSwineford1939,
           estimator = "WLS")
\end{Sinput}
\end{itemize}

\newpage
\sss{robust method 2: robust ML}
\begin{enumerate}
\item {\bfseries parameter estimates: vanilla ML}
\begin{itemize}
\item if ML is used, the parameter estimates are still consistent (if the model
is identified and correctly specified)
\end{itemize}
\item {\bfseries `robust' standard errors}
\begin{itemize}
\item if data are non-normal, the standard errors tend to be too small (as
much as 25-50\%)
\item `robust' standard errors correct for non-normality (see Appendix)
\end{itemize}
\item {\bfseries `robust' scaled (chi-square) test statistic}
\begin{itemize}
\item if data are non-normal, the usual model (chi-square) test statistic 
tends to be too large
\item the {\bfseries Satorra-Bentler scaled test statistic} rescales the value
of the ML-based chi-square test statistic by an amount that reflects the degree
of kurtosis (see Appendix)
\end{itemize}
\end{enumerate}

\newpage
\sss{robust ML in lavaan}
\begin{itemize}
\item robust standard errors
\begin{Sinput}
fit <- cfa(HS.model, data = HolzingerSwineford1939,
           se = "robust")
\end{Sinput}
\item Satorra-Bentler scaled test statistic
\begin{Sinput}
fit <- cfa(HS.model, data = HolzingerSwineford1939,
           test = "Satorra-Bentler")
\end{Sinput}
\item robust standard errors + scaled test statistic
\begin{Sinput}
fit <- cfa(HS.model, data = HolzingerSwineford1939,
           se = "robust", test = "Satorra-Bentler")
\end{Sinput}
\item estimator MLM = robust standard errors + scaled test statistic
\begin{Sinput}
fit <- cfa(HS.model, data = HolzingerSwineford1939,
           estimator = "MLM")
\end{Sinput}
\item alternative: estimator MLR (also for missing data)
\begin{Sinput}
fit <- cfa(HS.model, data = HolzingerSwineford1939,
           estimator = "MLR", missing = "ml")
\end{Sinput}
\end{itemize}

\newpage
\sss{output: robust standard errors and scaled test statistic}
\begin{Sinput}
> fit <- cfa(HS.model,
             data = HolzingerSwineford1939,
             estimator = "MLM")

> summary(fit, fit.measures=TRUE)
lavaan (0.5-20) converged normally after  35 iterations

  Number of observations                           301

  Estimator                                         ML      Robust
  Minimum Function Test Statistic               85.306      80.872
  Degrees of freedom                                24          24
  P-value (Chi-square)                           0.000       0.000
  Scaling correction factor                                  1.055
    for the Satorra-Bentler correction

Model test baseline model:

  Minimum Function Test Statistic              918.852     789.298
  Degrees of freedom                                36          36
  P-value                                        0.000       0.000

Full model versus baseline model:

  Comparative Fit Index (CFI)                    0.931       0.925
  Tucker-Lewis Index (TLI)                       0.896       0.887
\end{Sinput}

\sss{mimic option}
\begin{Sinput}
> cfa(HS.model, data = HolzingerSwineford1939,
      estimator = "MLM", mimic = "EQS")
...
  Estimator                                         ML      Robust
  Minimum Function Test Statistic               85.022      81.141
...

> cfa(HS.model, data = HolzingerSwineford1939,
      estimator = "MLM", mimic = "Mplus")

...
  Estimator                                         ML      Robust
  Minimum Function Test Statistic               85.306      81.908
...

> cfa(HS.model, data = HolzingerSwineford1939,
      estimator = "MLM", mimic = "lavaan")
...
  Estimator                                         ML      Robust
  Minimum Function Test Statistic               85.306      80.872
...
\end{Sinput}




\newpage
\sss{robust method 3: bootstrapping}
\begin{enumerate}
\item {\bfseries parameter estimates: vanilla ML}
\item {\bfseries bootstrapping standard errors}
\begin{itemize}
\item for the standard errors, we can use the usual nonparametric
bootstrap:
\begin{enumerate}
\item take a bootstrap sample (random selection of cases with replacement)
\item fit the model using this bootstrap sample
\item extract the $t$ estimated values of the free parameters
\item repeat steps 1--3 $R$ times (typically, $R > 1000$)
\end{enumerate}
\item collect all these values in a matrix of size $R \times t$
\item the bootstrap standard errors are the square root of the diagonal
elements of the covariance matrix of this $R \times t$ matrix
\end{itemize}

\newpage
\item {\bfseries bootstrapping the test statistic}
\begin{itemize}
\item for the test statistic, we cannot use the usual nonparametric bootstrap,
because it reflects not only non-normality and sampling variability, but also
model misfit
\item the original sample must first be transformed so that the
sample covariance matrix corresponds with the model-implied covariance matrix
\item in the SEM literature, this model-based bootstrap procedure is known as
{\bfseries the Bollen-Stine bootstrap}
\item the standard $p$~value of the chi-square test can be replaced
by a bootstrap $p$~value: the proportion of test statistics from
the bootstrap samples that exceed the value of the test statistic from
the original (parent) sample
\end{itemize}
\end{enumerate}

\newpage
\sss{bootstrapping in lavaan}
\begin{itemize}
\item bootstrapping standard errors:
\begin{Sinput}
fit <- cfa(HS.model, data = HolzingerSwineford1939,
           se = "bootstrap", verbose = TRUE, bootstrap = 1000)
\end{Sinput}
\item bootstrapping the test statistic
\begin{Sinput}
fit <- cfa(HS.model, data = HolzingerSwineford1939,
           test = "bootstrap", verbose = TRUE, bootstrap = 1000)
\end{Sinput}
\item when we use  se = ``bootstrap'', the parameterEstimates() output will 
contain bootstrap based confidence intervals
\end{itemize}



\newpage
\sss{using bootstrapLavaan() to compute the Bollen-Stine p-value (optional)}
\begin{Routput}
fit <- cfa(HS.model, data = HolzingerSwineford1939, se = "none")

# get the test statistic for the original sample

T.orig <- fitMeasures(fit, "chisq")

# bootstrap to get bootstrap test statistics
# we only generate 10 bootstrap sample in this example; in practice
# you may wish to use a much higher number

T.boot <- bootstrapLavaan(fit,
                          R = 10,
                          type = "bollen.stine",
                          FUN = fitMeasures,
                          fit.measures = "chisq")

# compute a bootstrap based p-value

pvalue.boot <- length(which(T.boot > T.orig))/length(T.boot)
\end{Routput}



\newpage
\subsection{Handling categorical endogenous variables}
\sss{categorical exogenous variables}
\begin{itemize}
\item categorical exogenous covariates; eg.\ gender, country
\item we simply need to construct `dummy variables' and proceed as usual
\item just like in ordinary regression
\end{itemize}
\sss{categorical endogenous variables}
\begin{itemize}
\item need special treatment
\item binary data, ordinal (ordered) data
\item censored data, limited dependent data
\item count data
\item nominal (unordered) data
\end{itemize}



\newpage
\sss{two approaches for handling categorical data in a SEM framework}
\begin{itemize}
\item limited information approach
\begin{itemize}
\item only univariate and bivariate information is used (think contingency tables)
\item estimation often proceeds in two or three stages; the first stages
use maximum likelihood, the last stage uses (weighted) least squares
\item mainly developed in the SEM literature
\item perhaps the best known implementation is in Mplus (WLSMV)
\end{itemize}
\end{itemize}

\newpage
\sss{two approaches for handling categorical data in a SEM framework}
\begin{itemize}
\item full information approach
\begin{itemize}
\item all information is used
\item most practical: marginal maximum likelihood estimation
\item requires numerical integration (number of dimensions = number of latent variables)
\item mainly developed in the IRT literature (and GLMM literature)
\item only recently incorporated in modern SEM software
\end{itemize}
\end{itemize}


\newpage
\sss{a limited information approach: the WLSMV estimator}
\begin{itemize}
\item developed by Bengt Muth\'{e}n, in a series of papers; the seminal paper is
\begin{quote}
Muth\'{e}n, B. (1984). A general structural equation model with
dichotomous, ordered categorical, and continuous latent variable
indicators. {\itshape Psychometrika, 49}, 115--132
\end{quote}
\item this approach has been the `gold standard' in the SEM literature for
almost three decades
\item first available in LISCOMP (Linear Structural Equations using a
Comprehensive Measurement Model), distributed by SSI, 1987 -- 1997
\item follow up program: Mplus (Version 1: 1998), currently version 8
\item other authors (J\"{o}reskog 1994; Lee, Poon, Bentler 1992) have proposed
similar approaches (implemented in LISREL and EQS respectively)
%\item another great program: MECOSA (Arminger, G., Wittenberg, J., Schepers, A.) written in the GAUSS language (mid 90's)
\end{itemize}

\newpage
\enlargethispage{1cm}
\sss{stage 1 -- estimating the thresholds (1)}
\begin{itemize}
\item an observed variable $y$ can often be viewed as a partial observation
of a latent continuous response $y^{\star}$; eg ordinal variable with $K=4$ response categories:\\*[-1.0cm]
\includegraphics[scale=0.6]{thresholds.pdf}
\end{itemize}

\newpage
\sss{stage 1 -- estimating the thresholds (2)}
\begin{itemize}
\item estimating the thresholds: maximum likelihood using univariate data
\begin{itemize}
\item if no exogenous variables, this is just
\begin{Sinput}
# generate `ordered' data with 4 categories
Y <- sample(1:4, size = 100, replace = TRUE)

prop <- table(Y)/sum(table(Y))
cprop <- c(0, cumsum(prop))

th <- qnorm(cprop)
\end{Sinput}
\item in the presence of exogenous covariates, this is just ordered probit
regression
\begin{Sinput}
library(MASS)
X1 <- rnorm(100); X2 <- rnorm(100); X3 <- rnorm(100)

fit <- polr(ordered(Y) ~ X1 + X2 + X3, method = "probit")
fit$zeta
\end{Sinput}
\end{itemize}
\end{itemize}
\newpage
\sss{stage 2 -- estimating tetrachoric, polychoric, \ldots, correlations}
\begin{itemize}
\item estimate tetrachoric/polychoric/\ldots correlation from bivariate data:
\begin{itemize}
\item tetrachoric (binary -- binary)
\item polychoric (ordered -- ordered)
\item polyserial (ordered -- numeric)
\item biserial (binary -- numeric)
\item pearson (numeric -- numeric)
\end{itemize}
\item ML estimation is available (see eg.\ Olsson 1979 and 1982)
\begin{itemize}
\item two-step: first estimate thresholds using univariate information only; then, keeping the thresholds fixed, estimate the correlation
\item one-step: estimate thresholds and correlation simultaneously
\end{itemize}
\item if exogenous covariates are involved, the correlations are based on
the residual values of $y^{\star}$ (eg bivariate probit regression)
\end{itemize}

\newpage
\sss{stage 3 -- estimating the SEM model}
\begin{itemize}
\item third stage uses weighted least squares:
\[ F_{WLS} = (\mathbf{s} - \hat{\mbox{\boldmath$\sigma$}})^\top \mathbf{W}^{-1}
       (\mathbf{s} - \hat{\mbox{\boldmath$\sigma$}})
       \]
       where $\mathbf{s}$ and $\hat{\mbox{\boldmath$\sigma$}}$ are vectors containing
       all relevant sample-based and model-based statistics respectively
       \item $\mathbf{s}$ contains: thresholds, correlations, optionally regression
       slopes of exogenous covariates, optionally variances and means of 
       continuous variables
       \item the weight matrix $\mathbf{W}$ is (a consistent estimator of) the
       asymptotic covariance matrix of the sample statistics ($\mathbf{s}$)
       \item robust version: WLSMV
       \begin{itemize}
       \item use the diagonal of $\vet{W}$ only for estimation (DWLS)
       \item use the full matrix for inference (standard errors and test statistic)
       \item `MV' stands for the Satterthwaite's mean and variance corrected test statistic
       \end{itemize}
       \end{itemize}

\newpage
\sss{using categorical variables in lavaan}
\begin{itemize}
\item declare them as `ordered' (using the \code{ordered()} function, which is
part of base \proglang{R}) in your data.frame
before you run the analysis;\\

for example, if you need to declare four variables
(say, item1, item2, item3, item4) as ordinal in your data.frame (called
`Data'), you can use something like:
\begin{Sinput}
Data[,c("item1","item2","item3","item4")] <-
    lapply(Data[,c("item1","item2","item3","item4")], ordered)
\end{Sinput}
\item use the \code{ordered=} argument when using one of the fitting functions;
for example, if you have four binary or ordinal
variables (say, item1, item2, item3, item4), you can use:
\begin{Sinput}
fit <- cfa(myModel, data = myData, ordered = c("item1","item2",
                                               "item3","item4"))
\end{Sinput}
\item by default, lavaan will use robust WLS (DWLS + robust standard errors and a scaled-shifted test statistic; this is equivalent to estimator=WLSMV in Mplus)
\end{itemize}

\newpage
\sss{example}
\begin{Sinput}
# binary version of Holzinger & Swineford
HS9 <- HolzingerSwineford1939[,c("x1","x2","x3","x4","x5",
                                 "x6","x7","x8","x9")]
HSbinary <- as.data.frame( lapply(HS9, cut, 2, labels = FALSE) )

# single factor model
model <- ' visual  =~ x1 + x2 + x3
           textual =~ x4 + x5 + x6
           speed   =~ x7 + x8 + x9 '
                      
# binary CFA
fit <- cfa(model, data=HSbinary, ordered = names(HSbinary))

summary(fit, fit.measures = TRUE)
\end{Sinput}
\newpage
\sss{output}
\begin{Routput}
lavaan (0.5-20) converged normally after  35 iterations

  Number of observations                           301

  Estimator                                       DWLS      Robust
  Minimum Function Test Statistic               30.918      38.546
  Degrees of freedom                                24          24
  P-value (Chi-square)                           0.156       0.030
  Scaling correction factor                                  0.866
  Shift parameter                                            2.861
    for simple second-order correction (Mplus variant)

Model test baseline model:

  Minimum Function Test Statistic              582.533     469.769
  Degrees of freedom                                36          36
  P-value                                        0.000       0.000

User model versus baseline model:

  Comparative Fit Index (CFI)                    0.987       0.966
  Tucker-Lewis Index (TLI)                       0.981       0.950

Root Mean Square Error of Approximation:

  RMSEA                                          0.031       0.045
  90 Percent Confidence Interval          0.000  0.059       0.014  0.070
  P-value RMSEA <= 0.05                          0.847       0.596

Weighted Root Mean Square Residual:

  WRMR                                           0.829       0.829

Parameter Estimates:

  Information                                 Expected
  Standard Errors                           Robust.sem

Latent Variables:
                   Estimate  Std.Err  Z-value  P(>|z|)
  visual =~                                           
    x1                1.000                           
    x2                0.900    0.188    4.788    0.000
    x3                0.939    0.197    4.766    0.000
  textual =~                                          
    x4                1.000                           
    x5                0.976    0.118    8.241    0.000
    x6                1.078    0.125    8.601    0.000
  speed =~                                            
    x7                1.000                           
    x8                1.569    0.461    3.403    0.001
    x9                1.449    0.409    3.541    0.000

Covariances:
                   Estimate  Std.Err  Z-value  P(>|z|)
  visual ~~                                           
    textual           0.303    0.061    4.981    0.000
    speed             0.132    0.049    2.700    0.007
  textual ~~                                          
    speed             0.076    0.046    1.656    0.098

Intercepts:
                   Estimate  Std.Err  Z-value  P(>|z|)
    x1                0.000                           
    x2                0.000                           
    x3                0.000                           
    x4                0.000                           
    x5                0.000                           
    x6                0.000                           
    x7                0.000                           
    x8                0.000                           
    x9                0.000                           
    visual            0.000                           
    textual           0.000                           
    speed             0.000                           

Thresholds:
                   Estimate  Std.Err  Z-value  P(>|z|)
    x1|t1            -0.388    0.074   -5.223    0.000
    x2|t1            -0.054    0.072   -0.748    0.454
    x3|t1             0.318    0.074    4.309    0.000
    x4|t1             0.180    0.073    2.473    0.013
    x5|t1            -0.257    0.073   -3.506    0.000
    x6|t1             1.024    0.088   11.641    0.000
    x7|t1             0.231    0.073    3.162    0.002
    x8|t1             1.128    0.092   12.284    0.000
    x9|t1             0.626    0.078    8.047    0.000

Variances:
                   Estimate  Std.Err  Z-value  P(>|z|)
    x1                0.592                           
    x2                0.670                           
    x3                0.640                           
    x4                0.303                           
    x5                0.336                           
    x6                0.191                           
    x7                0.778                           
    x8                0.453                           
    x9                0.534                           
    visual            0.408    0.112    3.651    0.000
    textual           0.697    0.101    6.883    0.000
    speed             0.222    0.094    2.363    0.018

Scales y*:
                   Estimate  Std.Err  Z-value  P(>|z|)
    x1                1.000                           
    x2                1.000                           
    x3                1.000                           
    x4                1.000                           
    x5                1.000                           
    x6                1.000                           
    x7                1.000                           
    x8                1.000                           
    x9                1.000                           

> inspect(fit, "sampstat")
$cov
x1     x2     x3     x4     x5     x6     x7     x8     x9
x1  1.000
x2  0.284  1.000
x3  0.415  0.389  1.000
x4  0.364  0.328  0.232  1.000
x5  0.319  0.268  0.138  0.688  1.000
x6  0.422  0.322  0.206  0.720  0.761  1.000
x7 -0.048  0.061  0.041  0.200  0.023 -0.029  1.000
x8  0.159  0.105  0.439 -0.029 -0.059  0.183  0.464  1.000
x9  0.165  0.210  0.258  0.146  0.183  0.230  0.335  0.403  1.000

$mean
x1 x2 x3 x4 x5 x6 x7 x8 x9 
 0  0  0  0  0  0  0  0  0 

$th
 x1|t1  x2|t1  x3|t1  x4|t1  x5|t1  x6|t1  x7|t1  x8|t1  x9|t1
-0.388 -0.054  0.318  0.180 -0.257  1.024  0.231  1.128  0.626
\end{Routput}

\subsection{Growth models}
\begin{itemize}
\item the SEM framework accommodates many longitudinal models, where a single measure is administered repeatedly over time (vs multiple measures at once)
\item latent variables can be used as ``random effects'' associated with various model parameters (similar to multilevel/hierarchical models)
\item a latent variable no longer represents a trait of interest; it can represent something about growth (e.g., a slope describing change over time)
\end{itemize}

\newpage
\begin{itemize}
\item in the model below, everyone is measured at five equally-spaced time points; $\eta_1$ is a random intercept and $\eta_2$ is a random slope
\end{itemize}
\begin{center}
\begin{tikzpicture}[>=stealth,semithick]
\node[ov] (y1) at (0,-1)      {$y_1$};
\node[ov] (y2) [below of=y1]  {$y_2$};
\node[ov] (y3) [below of=y2]  {$y_3$};
\node[ov] (y4) [below of=y3]  {$y_4$};
\node[ov] (y5) [below of=y4]  {$y_5$};

\node[lv] (f1) at (3, -1.5)  {$\eta_1$};
\node[lv] (f2) at (3, -4.5)  {$\eta_2$};

\path[->] (f1) edge node[above,pos=.3,scale=0.6] {1} (y1)
          (f1) edge node[above,pos=.3,scale=0.6] {1} (y2)
          (f1) edge node[above,pos=.3,scale=0.6] {1} (y3)
          (f1) edge node[above,pos=.3,scale=0.6] {1} (y4)
          (f1) edge node[above,pos=.3,scale=0.6] {1} (y5)
          (f2) edge node[above,pos=.3,scale=0.6] {0} (y1)
          (f2) edge node[above,pos=.3,scale=0.6] {1} (y2)
          (f2) edge node[above,pos=.3,scale=0.6] {2} (y3)
          (f2) edge node[above,pos=.3,scale=0.6] {3} (y4)
          (f2) edge node[above,pos=.3,scale=0.6] {4} (y5);

\path[<->] (f1.east) edge [bend left=45] node[left,scale=0.8] {} (f2.east);
\end{tikzpicture}
\end{center}

\newpage
\sss{growth models}
\begin{itemize}
\item the latent variable represents a slope, so the loading parameters must represent something about time
\item this is where the model starts to look different from traditional SEMs: we fix loading parameters to correspond to time points at which people are measured
\item note this only works well when everyone is measured at the same time points (though see {\em definition variables} in Mplus)
\end{itemize}


\newpage
\sss{growth vs multilevel}
\begin{itemize}
\item the growth model from the previous slide corresponds exactly to a multilevel model with a random slope and intercept, where everyone is measured at exactly the same time
\item if you have seen R package {\em lme4}, the command would be something like\\
\begin{Sinput}
fit <- lmer(y ~ time + (time | person))
\end{Sinput}
where the data are in long format for {\em lme4}: each row is a single observation at a single time (vs a person), \verb+time+ repeats the time points 0--4 for each person, and \verb+person+ is a ``person id'' column
\item models can get much more complex than this; see, e.g.\\ McArdle, J.\ J.\ (2009). Latent variable modeling of differences and changes with longitudinal data. {\em Annual Review of Psychology, 60}, 577--605.
\end{itemize}

\newpage
\section{Appendices}
\subsection{Rules about variances and covariances}
\begin{itemize}
\item consider the following path diagram:
\vspace*{0.5cm}
\begin{center}
\begin{tikzpicture}[>=stealth,semithick]
% y1
\node[ov] (y1)                {$y_1$};

% y2 and y3
\begin{scope}[xshift=1.5cm]
\node[av] (y2) at (0,0)    {$y_2$};
\node[av] (y3) at (0,-1.5) {$y_3$};
\end{scope}

\path[->] (y1) edge node[above,scale=0.6] {a} (y2)
          (y1) edge node[above,scale=0.6] {b} (y3);
\end{tikzpicture}
\end{center}
\item the two corresponding linear equations are:
\[ \left\{ \begin{array}{r}  y_2 = a \, y_1 + \epsilon_{2} \\
                             y_3 = b \, y_1 + \epsilon_{3} 
           \end{array} \right. \]

\newpage
\item the two equations imply how the three variables are related to
    each other: there is a relationship between $y_2$ and $y_1$, and
    $y_3$ and $y_1$; there is also a relationship between $y_2$ and
    $y_3$ (because, there is a common cause)
\item to quantify the (linear) relationship between two variables, we
    use the {\itshape covariance}
\item suppose we have already estimated the values of the structural
    coefficients $a$ and $b$, can we derive:
    \begin{enumerate}
        \item the {\itshape model-implied covariances} for each
        pair of variables in the set $(y_1, y_2, y_3)$?
        \item the {\itshape variances} of the (endogenous) variables
    $y_2$ and $y_3$?
        \item what about the variance of the exogenous variable $y_1$?
    \end{enumerate}
\item the {\itshape model-implied} variance covariance
    matrix $\hat{\vet{\Sigma}}$:
\[
    \left[ \begin{array}{lll} \sigma^2(y_1) & & \\
                             \sigma(y_2,y_1) & \sigma^2(y_2) & \\
                             \sigma(y_3,y_1) & \sigma(y_3,y_2) & \sigma^2(y_3) 
            \end{array}\right]
\]
\end{itemize}


\newpage
\subsubsection*{rules about variances and covariances (1)}
\begin{itemize}
\item suppose $X$ and $Y$ are random variables, and $a$ and $b$ are constants.
\item some simple rules for variances:
\begin{itemize}
\item $\sigma^2(a) = 0$
\item $\sigma^2(a + X) = \sigma^2(X)$
\item $\sigma^2(aX) = a^2 \, \sigma^2(X)$
\item $\sigma^2(X + Y) = \sigma^2(X) + \sigma^2(Y) + 2 \, \sigma(X,Y)$
\end{itemize}
\item some simple rules for covariances:
\begin{itemize}
\item $\sigma(a,b) = 0$
\item $\sigma(a,X) = 0$
\item $\sigma(X,Y) = \sigma(Y,X)$
\item $\sigma(X+a, Y+b) = \sigma(X,Y)$
\item $\sigma(aX,bY) = a \,b \,\sigma(X,Y)$
\end{itemize}
\end{itemize}

\newpage
\subsubsection*{rules about variances and covariances (2)}
\begin{itemize}
\item given two linear combinations $X$ and $Y$:
        \[ X = a_1 X_1 + a_2 X_2 + \ldots + a_p X_p \quad \mbox{and} \quad
           Y = b_1 Y_1 + b_2 Y_2 + \ldots + b_q Y_q \]
\item the general formula for the variance of a linear combination
        is given by
\begin{eqnarray*}
\sigma^2(X) &=& \sum_{i=1}^p \sum_{j=1}^p a_i a_j \sigma(X_i, X_j)\\
&=&\sum_{i=1}^p a_i^2 \sigma^2(X_i) + 
        \sum_{i=1}^p \sum_{j \neq i}^p a_i a_j \sigma(X_i, X_j) 
\end{eqnarray*}
\item the covariance between these two linear combinations is
        given by
        \[ \sigma(X,Y) = \sum_{i=1}^p \sum_{j=1}^q a_i b_j \sigma(X_i, Y_j) \]
\end{itemize}

\newpage
\subsubsection*{applying the rules}
\begin{itemize}
\item following the rules for the covariances, we find:
\begin{itemize}
\item $\sigma(y_2, y_3) = a \, b \, \sigma(y_1, y_1) + a \, \sigma(y_1, \epsilon_3) + b \, \sigma(y_1, \epsilon_2) + \sigma(\epsilon_2, \epsilon_3)$
\item $\sigma(y_2, y_1) = a \, \sigma(y_1, y_1) + \sigma(y_1, \epsilon_2)$
and $\sigma(y_3, y_1) = b \, \sigma(y_1, y_1) + \sigma(y_1, \epsilon_3)$
\item but $\sigma(y_1, y_1) = \sigma^2(y_1)$, $\sigma(y_1, \epsilon_3) = 0$,
$\sigma(y_1, \epsilon_2) = 0$, and we also assume (here) that
$\sigma(\epsilon_2, \epsilon_3) = 0$
\end{itemize}
\item following the rules for variances, we find:
\begin{itemize}
\item $\sigma^2(y_1) = \sigma^2(y_1)$
\item $\sigma^2(y_2) = a^2 \sigma^2(y_1) + \sigma^2(\epsilon_2)$ and
$\sigma^2(y_3) = b^2 \sigma^2(y_1) + \sigma^2(\epsilon_3)$
\end{itemize}
\item the {\itshape model-implied} variance covariance
    matrix for our two equations is
\[ \left[ \begin{array}{rrr} 
\sigma^2(y_1) & & \\
a \, \sigma^2(y_1) &  a^2 \, \sigma^2(y_1) + \sigma^2(\epsilon_2)& \\
b \, \sigma^2(y_1) & a \,b \, \sigma^2(y_1) &  b^2 \,\sigma^2(y_1) + \sigma^2(\epsilon_3)
\end{array}\right]
\]
\end{itemize}

\subsubsection*{the model-implied covariance matrix for our two-equation model}
\begin{itemize}
\item for example, if $a=3$ and $b=5$, $\sigma^2(y_1) = 10$,
$\sigma^2(\epsilon_2) = 20$ and $\sigma^2(\epsilon_3) = 30$, then
for this model:
\begin{center}
\begin{tikzpicture}[>=stealth,semithick]
% y1
\node[ov] (y1)                {$y_1$};

% y2 and y3
\begin{scope}[xshift=1.5cm]
\node[av] (y2) at (0,0)    {$y_2$};
\node[av] (y3) at (0,-1.5) {$y_3$};
\end{scope}

\path[->] (y1) edge node[above,scale=0.6] {a} (y2)
          (y1) edge node[above,scale=0.6] {b} (y3);
\end{tikzpicture}
\end{center}
we find
\[
\hat{\vet{\Sigma}} = \left[ \begin{array}{rrr} 
10 & & \\
30 & 110 & \\
50 & 150 & 280 
\end{array}\right]
\]
\end{itemize}

\newpage
\subsubsection*{the model-implied covariance in a one-factor CFA}
\begin{itemize}
\item consider this simple one-factor CFA with three indicators:
\begin{center}
\begin{tikzpicture}[>=stealth,semithick]
\node[ov] (y1) at (0,-1)      {$y_1$};
\node[ov] (y2) [below of=y1]  {$y_2$};
\node[ov] (y3) [below of=y2]  {$y_3$};

\node[lv] (f1) at (1.5, -2)  {$\eta_1$};

\path[->] (f1) edge node[above,scale=0.6] {$\lambda_1$} (y1)
          (f1) edge node[above,scale=0.6] {$\lambda_2$} (y2)
          (f1) edge node[above,scale=0.6] {$\lambda_3$} (y3);
\end{tikzpicture}
\end{center}
\item the model-implied covariance is again a function of the
model parameters:
\[ \left[ \begin{array}{lll} 
\lambda_1^2 \sigma^2(\eta_1) + \sigma^2(\epsilon_1) & & \\
\lambda_1 \lambda_2 \sigma^2(\eta_1) &  
\lambda_2^2 \sigma^2(\eta_1) + \sigma^2(\epsilon_2)& \\
\lambda_1 \lambda_3 \sigma^2(\eta_1) & 
\lambda_2 \lambda_3 \sigma^2(\eta_1) & 
\lambda_3^2 \sigma^2(\eta_1) + \sigma^2(\epsilon_3) 
\end{array}\right]
\]
where we have assumed that the $\epsilon$'s are uncorrelated.
\end{itemize}


\newpage
\subsection{Estimator ML, MLM and MLR: robust standard errors and scaled test statistics}
\sss{estimator ML}
\begin{itemize}
\item ML is the default estimator in all software packages for SEM
\item the likelihood function is derived from the multivariate normal
distribution (the `normal' tradition) or the Wishart distribution (the
`Wishart' tradition)
\item standard errors are usually based on the covariance matrix that is obtained
by inverting the expected information matrix
\begin{align*} n \mbox{Cov}(\hat{\theta}) &= A^{-1}
                                        = (\Delta' W \Delta)^{-1} 
\end{align*}
\begin{itemize}
\item $\Delta$ is a jacobian matrix and $W$ is a function of $\Sigma^{-1}$
\item if no meanstructure:
\begin{align*}
\Delta &= \partial \hat{\Sigma} / \partial \hat{\theta}'\\
     W &= \frac{1}{2} D' (\hat{\Sigma}^{-1} \otimes \hat{\Sigma}^{-1}) D
\end{align*}
\end{itemize}
\newpage
\item an alternative is to use the {\itshape observed}
information matrix 
\begin{align*}
n \mbox{Cov}(\hat{\theta}) &= A^{-1}\\
                           &= \left[- \text{Hessian} \right]^{-1}\\
                           &= \left[- \partial F(\hat{\theta}) / (\partial \hat{\theta} \partial \hat{\theta}') \right]^{-1}
\end{align*}
where $F(\theta)$ is the function that is minimized
\item overall model evaluation is based on the likelihood-ratio (LR)
statistic (chi-square test): $T_{ML}$
\begin{itemize}
\item (minus two times the) difference
between loglikelihood of user-specified model $H_0$ and
unrestricted model $H_1$
\item equals (in lavaan 0.5) $2\times n$ times the minimum value of $F(\theta)$
\item $T_{ML}$ follows (under regularity conditions) a chi-square
distribution
\end{itemize}
\end{itemize}

\newpage
\sss{estimator MLM}
\begin{itemize}
\item parameter estimates are standard ML estimates
\item standard errors are robust to non-normality
\begin{itemize}
\item standard errors are computed using a sandwich-type estimator:
\begin{align*} n \mbox{Cov}(\hat{\theta}) &= A^{-1} B A^{-1}\\
                                        &= (\Delta' W \Delta)^{-1} 
(\Delta' W \Gamma W \Delta) (\Delta' W \Delta)^{-1}
\end{align*}
\item $A$ is usually the expected information matrix (but not in Mplus)
\item references: Huber (1967), Browne (1984), Shapiro (1983), Bentler (1983), \ldots
\end{itemize}
\newpage
\item chi-square test statistic is robust to non-normality
\begin{itemize}
\item test statistic is `scaled' by a correction factor
\[ T_{SB} = T_{ML}/c \]
\item the scaling factor $c$ is computed by:
\[ c = tr\left[U \Gamma \right] / \mbox{df} \]
where
\[U = (W^{-1} - W^{-1} \Delta (\Delta' W^{-1} \Delta)^{-1} \Delta' W^{-1})\]
\item correction method described by Satorra \& Bentler (1986, 1988, 1994)
\end{itemize}
\item estimator MLM: for complete data only
\end{itemize}

\newpage
\sss{estimator MLR}
\begin{itemize}
\item parameter estimates are standard ML estimates
\item standard errors are robust to non-normality
\begin{itemize}
\item standard errors are computed using a (different) sandwich approach:
\begin{align*}
n \mbox{Cov}(\hat{\theta}) &= A^{-1} B A^{-1}\\
                           &= A_0^{-1} B_0 A_0^{-1} = C_0
\end{align*}
where
\[ A_0 = - \sum_{i=1}^n \frac{\partial \log L_i}{\partial \hat{\theta} \, 
\partial \hat{\theta}'} \quad \mbox{(observed information)}
\]
and
\[ B_0 = \sum_{i=1}^n 
\left(\frac{\partial \log L_i}{\partial \hat{\theta}}\right) 
\times \left(\frac{\partial \log L_i}{\partial \hat{\theta}}\right)' \]
\item for both complete and incomplete data
\item Huber (1967), Gourieroux, Monfort \& Trognon (1984), Arminger \&
Schoenberg (1989)
\end{itemize}
\item chi-square test statistic is robust to non-normality
\begin{itemize}
\item test statistic is `scaled' by a correction factor
\[ T_{MLR} = T_{ML} / c \]
\item the scaling factor $c$ is (usually) computed by
\[ c = tr \left[ M \right] \]
where
\[ M = C_1(A_1 - A_1 \Delta (\Delta' A_1 \Delta)^{-1} \Delta' A_1) \]
\item $A_1$ and $C_1$ are computed under the unrestricted ($H_1$) model
\item correction method described by Yuan \& Bentler (2000)
\end{itemize}
\item information matrix ($A$) can be observed or expected
\item for complete data, the MLR and MLM corrections are asymptotically
equivalent
\end{itemize}


\end{document}
