[R] [R-pkgs] New package: `lavaan' for latent variable analysis (including structural equation modeling)

Yves Rosseel Yves.Rosseel at UGent.be
Tue May 25 09:31:25 CEST 2010


On 05/24/2010 09:53 PM, JLucke at ria.buffalo.edu wrote:
>
> Yves
> Would it by to much to ask of you to supply a copy of your LaTeX for the
> tikz/pgf? I would like to learn tikz/pgf and your pictures are
> motivating examples.
> Joe

When I find the time, I will put the complete latex source of the 
tutorial on the webpage. But the tikz/pgf code for the second example is 
given below:

%% this goes in the latex preamble
\usepackage{tikz}
\tikzstyle{ov}=[shape=rectangle,
                 draw=black!80,
                 minimum height=0.75cm,
                 minimum width=1cm,
                 thick]

\tikzstyle{av}=[shape=rectangle,
                 draw=black!80,
                 fill=black!10,
                 minimum height=1cm,
                 minimum width=1cm,
                 thick]

\tikzstyle{lv}=[shape=circle,draw=black!80,thick,minimum width=1.5cm]

%% this the tikz code for the SEM example
\begin{center}
\begin{tabular}{p{0.5\textwidth}p{0.4\textwidth}} \hline
\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}

-- 
Yves Rosseel -- http://www.da.ugent.be
Department of Data Analysis, Ghent University
Henri Dunantlaan 1, B-9000 Gent, Belgium



More information about the R-help mailing list