%% Prof. Ed Merkle, University of Missouri
%% Charlie Redmon, University of Kansas
%% 20170918
%% SEM path diagram

% standalone class for individual image to be included in a document
% border=15pt controls the whitespace padding around the diagram
\documentclass[border=15pt]{standalone}

% load custom style configurations from separate file
\input{setupSEMstyle.tex}

\begin{document}

%% ">=stealth" sets the arrow head style
%% "semithick" sets the line width (0.6 pt)
\begin{tikzpicture}[>=stealth,semithick]

% observed variables (set 1)
\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$};

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

% observed variables (set 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}$};

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

% paths
\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{document}