I want to "draw" a mediator analysis with LaTeX, e.g. with TikZ. Unfortunately, I did not find any template for such a graphic; plus, I am lacking of skill to do it on my own (but very willing to learn!). Thus, I cannot offer a MWE! :(

The graphic shown below is made with Microsoft PP and displays some random variable names and values which should be replaceable with other variable names and values...


Can someone reproduce such a mediator model with TikZ? I also wonder if the font in the graphic will be the same like my document settings?

  • 1
    The font will be the same. You can have a look at the tutorials in the TikZ manual to get started... even if you provide a minimal example that doesn't do anything, just loads the correct packages, it will help us here :-) – darthbith Feb 1 '15 at 12:59

I won't provide explanations but suggest you to read pgfmanual. There are nice tutorials there as commented by darthbith. What you want can be easily done.

\tikzset{mynode/.style={draw,text width=1in,align=center}
    \node[mynode] (m){Mediator};
    \node[mynode,below left=of m](a) {Variable A};
    \node[mynode,below right=of m](b) {Variable B};
    \draw[-latex] (a.north) -- node[auto,font=\footnotesize] {$b=-0.56$, $p=0.04$} (m.west);
    \draw[-latex] (m.east) -- node[auto,font=\footnotesize] {$b=-0.44$, $p<0.001$} (b.north);
    \draw[-latex] (a.east) --
            node[below=3mm,font=\footnotesize,align=center] {Direct effect, $b=0.55$,
                 $p=0.03$ \\ Indirect effect, $b=0.16$, \SI{90}{\percent} CI [ 0.04,0.36]}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.