Need help polishing a figure I've drawn using TikZ. Let me begin by saying that I think TikZ is wonderful. I tried drawing figures like this using Microsoft Word previously. Using Word was quite painful. In contrast, learning to draw using TikZ was actually quite fun.
The code for drawing the figure appears below. I quite like the figure. I just need to make a couple of minor changes. In each of the triangles, I want the text centered both horizontally and vertically. Also, I'd like the line from the triangle on the far left to emanate from the middle of the right side. At the moment, it is placed to close to the bottom of the triangle.
The other thing I've been trying to figure out is how to refer to the components of the diagram in text. So, for example, I've figured out how to draw a circle in text, as shown immediately below the figure. What I'd really like to have appear there though is a triangle with a 1 and a subscripted 1 inside, like in the far left of the figure. The same goes for for the eleents with a 1 followed by a subscript under "Fixed Effects".
If anyone could show me how to make the necessary changes, I'd be most greatful.
Thanks,
Paul
Code: Select all
\documentclass{article}
\setlength{\textwidth}{6.25in}
\setlength{\oddsidemargin}{0in}
\usepackage{parskip}
\usepackage{setspace}
\usepackage{here}
\usepackage{tikz}
\usetikzlibrary{calc,shapes.geometric}
\usepackage[pdfview=Fit]{hyperref}
\begin{document}
\tikzstyle{arr}=[-latex, black, line width=0.5pt]
\tikzstyle{input}=[font=\small\sffamily\bfseries]
\tikzstyle{rect}=[rectangle, draw=black, font=\small\sffamily\bfseries, inner sep=9pt]
\tikzstyle{circ}=[circle, draw=black, font=\small\sffamily\bfseries,inner sep=6pt]
\tikzstyle{trigl}=[
isosceles triangle,
draw,
shape border rotate=90,
inner sep=3,
font=\small\sffamily\bfseries,
isosceles triangle apex angle=60,
isosceles triangle stretches]
\begin{figure}[H]
\begin{center}
\begin{tikzpicture}[auto]
% \node[trigl] (11) at (16, -0.23) {$1_1$};
\node[trigl] (11) at (16, 0) {$1_1$};
\node[circ] (B0j) at (20, 0) {$\beta_{oj}$};
\node[trigl] (12) at (20, 3) {$1_2$};
\node[rect] (Yij) at (24, 0) {$Y_{ij}$};
\node [input] (M0j) at (20,-3) {$\mu_{0j}$};
\node [input] (rij) at (26, 0) {$r_{ij}$};
% \draw (11.right side) to (B0j);
\draw (11) to (B0j);
\draw [arr] (12) to node {\scriptsize$\gamma_{00}$} (B0j);
\draw [arr] (B0j) to (Yij);
\draw [arr] (M0j) to (B0j);
\draw [arr] (rij) to (Yij);
\end{tikzpicture}
\end{center}
\caption{The Unconditional Means Model}
\end{figure}
Note how components from the figure (e.g., \tikz \draw (0,0) circle
(5pt);) can easily be inserted into inline text.
\begin{doublespace}
Fixed Effects
\hspace{6pt} Trace from $1_2$
\hspace{18pt} $(1_2$ $\gamma_{00}$ $1_1)$
Random Effects
\hspace{18pt} $(\mu_{0j}) + (r_{0j})$
Multilevel Equations
\begin{tabbing}
\hspace*{0.75in} \= ft \= \hspace*{3in} \= st \kill
\hspace{6pt} Level 1 \>\> $(1)(\beta_{oj}); (r_{ij})(1)$ \\
\>\> $Y_{ij} = \beta_{oj} + r_{ij}$ \\
\hspace{6pt} Level 2 \>\> $(1)(\gamma_{00}); (\mu_{0j})(1)$ \\
\>\> $\beta_{oj} = \gamma_{00} + \mu_{0j}$
\end{tabbing}
Reduced Form
\hspace{6pt} $Y_{ij} = [\gamma_{00}] + [\mu_{0j} + r_{0j}]$
\end{doublespace}
\end{document}