%% Chong Xing <cxing@ku.edu>
%% Paul Johnson <pauljohn@ku.edu>
%% 20181231
%% The path diagram for semexample/R/Ex-05-SEM/sem-01

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

\begin{document}

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

\node (iv1) at (-6, 3)  [draw, text width=2cm, align=center] {edlevel};
\node (iv2) at (-6, 2)  [draw, text width=2cm, align=center] {newschl};
\node (iv3) at (-6, 1)  [draw, text width=2cm, align=center] {suspend};
\node (iv4) at (-6, 0)  [draw, text width=2cm, align=center] {expelled};
\node (iv5) at (-6, -1) [draw, text width=2cm, align=center] {haveld};
\node (iv6) at (-6, -2) [draw, text width=2cm, align=center] {gender};
\node (iv7) at (-6, -3) [draw, text width=2cm, align=center] {age};

\node (factor1) at (0, 1)  [draw, ellipse, align=center] {MATH};
\node (factor2) at (0, -1) [draw, ellipse, align=center] {SPELL};

\node (indicator1) at (-2, 4)  [draw, text width=1.3cm, align=center, minimum height=0.6cm] {wratcalc};
\node (indicator2) at (0, 4)   [draw, text width=1.3cm, align=center, minimum height=0.6cm] {wjcalc};
\node (indicator3) at (2, 4)   [draw, text width=1.3cm, align=center, minimum height=0.6cm] {waiscalc};
\node (indicator4) at (-2, -4) [draw, text width=1.3cm, align=center, minimum height=0.6cm] {wratspl};
\node (indicator5) at (0, -4)  [draw, text width=1.3cm, align=center, minimum height=0.6cm] {wjspl};
\node (indicator6) at (2, -4)  [draw, text width=1.3cm, align=center, minimum height=0.6cm] {waisspl};

\path[->] (factor1.north) edge node[pos=0.55, fill=white, align=center, inner sep=0.5pt] {\footnotesize .950***} (indicator1.south);
\path[->] (factor1.north) edge node[pos=0.55, fill=white, align=center, inner sep=0.5pt] {\footnotesize .905***} (indicator2.south);
\path[->] (factor1.north) edge node[pos=0.55, fill=white, align=center, inner sep=0.5pt] {\footnotesize .732***} (indicator3.south);

\path[->] (factor2.south) edge node[pos=0.55, fill=white, inner sep=0.5pt] {\footnotesize .947***} (indicator4.north);
\path[->] (factor2.south) edge node[pos=0.55, fill=white, inner sep=0.5pt] {\footnotesize .952***} (indicator5.north);
\path[->] (factor2.south) edge node[pos=0.55, fill=white, inner sep=0.5pt] {\footnotesize .944***} (indicator6.north);

\path[->] (iv1.east) edge node[pos=0.50, fill=white, inner sep=0.5pt] {\footnotesize .342***} (factor1.west);
\path[->] (iv3.east) edge node[pos=0.20, fill=white, inner sep=0.5pt] {\footnotesize -.141*}   (factor1.west);
\path[->] (iv7.east) edge node[pos=0.20, fill=white, inner sep=0.5pt] {\footnotesize .193**}   (factor1.west);

\path[->] (iv1.east) edge node[pos=0.63, fill=white, inner sep=0.5pt] {\footnotesize .216***}  (factor2.west);
\path[->] (iv4.east) edge node[pos=0.20, fill=white, inner sep=0.5pt] {\footnotesize -.134*}    (factor2.west);
\path[->] (iv5.east) edge node[pos=0.20, fill=white, inner sep=0.5pt] {\footnotesize -.367***} (factor2.west);

\path[<->] (factor1.east) edge[bend left=45] node[midway, fill=white, inner sep=0.5pt] {\footnotesize .512***} (factor2.east);

\end{tikzpicture}

\end{document}