%% Meghan Sullivan
%% 20171205
%% Common factor model

% 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]

% response variables
\node[ov] (y1) at (0,-1)      {$y_1$};
\node[ov] (y2) [right of=y1]  {$y_2$};
\node[ov] (y3) [right of=y2]  {$y_3$};
\node[ov] (y4) [right of=y3]  {$y_4$};
\node[ov] (y5) [right of=y4]  {$y_5$};
\node[ov] (y6) [right of=y5]  {$y_6$};

% error terms
\draw[thin, ->] (0, -2) -- (y1);
\draw[thin, ->] (1, -2) -- (y2);
\draw[thin, ->] (2, -2) -- (y3);
\draw[thin, ->] (3, -2) -- (y4);
\draw[thin, ->] (4, -2) -- (y5);
\draw[thin, ->] (5, -2) -- (y6);
\node[text width=0cm, scale=0.6] at (-0.1, -2.2) {$\epsilon_1$};
\node[text width=0cm, scale=0.6] at (0.9, -2.2) {$\epsilon_2$};
\node[text width=0cm, scale=0.6] at (1.9, -2.2) {$\epsilon_3$};
\node[text width=0cm, scale=0.6] at (2.9, -2.2) {$\epsilon_4$};
\node[text width=0cm, scale=0.6] at (3.9, -2.2) {$\epsilon_5$};
\node[text width=0cm, scale=0.6] at (4.9, -2.2) {$\epsilon_6$};

% latent variable
\node[lv] (f1) at (1, 1.5)  {$\eta_1$};
\node[lv] (f2) at (4, 1.5)  {$\eta_2$};

% paths
\path[->] (f1) edge node[left,scale=0.6] {$1$} (y1)
          (f1) edge node[left,scale=0.6] {$\lambda_2$} (y2)
          (f1) edge node[left,scale=0.6] {$\lambda_3$} (y3)
          (f2) edge node[left,scale=0.6] {1} (y4)
          (f2) edge node[left,scale=0.6] {$\lambda_5$} (y5)
	  (f2) edge node[left,scale=0.6] {$\lambda_6$} (y6);

\end{tikzpicture}


\end{document}
