%% Meghan Sullivan
%% 20171205
%% Bifactor model with two specific factors; north south

% 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,scale=0.5]

% observed variables
\node[ov] (y1) at (-10,0)     {x1};
\node[ov] (y2) at (-8.5,0)  {x2};
\node[ov] (y3) at (-7,0)  {x3};
\node[ov] (y4) at (-5.5,0)  {x4};
\node[ov] (y5) at (-4,0)  {x5};
\node[ov] (y6) at (-2.5,0)    {x6};
\node[ov] (y7) at (-1,0)  {x7};
\node[ov] (y8) at (0.5,0)  {x8};

% latent variables
\node[lv] (f1) at (-7.5, 5)  {$\theta_1$};
\node[lv] (f2) at (-2.5, 5)  {$\theta_2$};
\node[lv] (f3) at (-5, -5)  {$\theta_g$};

% paths
\path[->] (f1) edge node[above=0.08cm,scale=0.8,pos=0.7] {} (y1.north);
\path[->] (f1) edge node[above=0.08cm,scale=0.8,pos=0.7] {} (y2.north);
\path[->] (f1) edge node[above=0.08cm,scale=0.8,pos=0.7] {} (y3.north);
\path[->] (f1) edge node[above=0.08cm,scale=0.8,pos=0.7] {} (y4.north);
\path[->] (f2) edge node[above=0.08cm,scale=0.8,pos=0.7] {} (y5.north);
\path[->] (f2) edge node[above=0.08cm,scale=0.8,pos=0.7] {} (y6.north);
\path[->] (f2) edge node[above=0.08cm,scale=0.8,pos=0.7] {} (y7.north);
\path[->] (f2) edge node[above=0.08cm,scale=0.8,pos=0.7] {} (y8.north);

\path[->] (f3) edge node[above=0.08cm,scale=0.8,pos=0.9] {} (y1.south);
\path[->] (f3) edge node[above=0.08cm,scale=0.8,pos=0.9] {} (y2.south);
\path[->] (f3) edge node[above=0.08cm,scale=0.8,pos=0.9] {} (y3.south);
\path[->] (f3) edge node[above=0.08cm,scale=0.8,pos=0.9] {} (y4.south);
\path[->] (f3) edge node[above=0.08cm,scale=0.8,pos=0.9] {} (y5.south);
\path[->] (f3) edge node[above=0.08cm,scale=0.8,pos=0.9] {} (y6.south);
\path[->] (f3) edge node[above=0.08cm,scale=0.8,pos=0.9] {} (y7.south);
\path[->] (f3) edge node[above=0.08cm,scale=0.8,pos=0.9] {} (y8.south);

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

\end{tikzpicture}



\end{document}
