Example: Scenario tree

Published 2008-06-08 | Author: Rasmus Pank Roulund

A scenario tree from the field of economics. The figure is a replication of a figure 4 from Barry Eichengreen’s NBER paper on “Hegemonic Stability Theories of the International Monetary System” from 1987 (PDF).

Author:Rasmus Pank Roulund

Download as: [PDF] [TEX]

Scenario tree

Do you have a question regarding this example, TikZ or LaTeX in general? Just ask in the LaTeX Forum.
Oder frag auf Deutsch auf TeXwelt.de. En français: TeXnique.fr.

% Scenario tree
% Author: Rasmus Pank Roulund
\documentclass{minimal}
\usepackage{tikz}
\usetikzlibrary{shapes}
\usepackage{amsmath}
\usepackage{xspace}
\newcommand{\A}{\ensuremath{\mathcal{A}}\xspace}
\newcommand{\B}{\ensuremath{\mathcal{B}}\xspace}
\newcommand\pa[1]{\ensuremath{\left(#1\right)}}
\begin{document}
\begin{tikzpicture}[
    grow=right,
    level 1/.style={sibling distance=3.5cm,level distance=5.2cm},
    level 2/.style={sibling distance=3.5cm, level distance=6.7cm},
    edge from parent/.style={very thick,draw=blue!40!black!60,
        shorten >=5pt, shorten <=5pt},
    edge from parent path={(\tikzparentnode.east) -- (\tikzchildnode.west)},
    kant/.style={text width=2cm, text centered, sloped},
    every node/.style={text ragged, inner sep=2mm},
    punkt/.style={rectangle, rounded corners, shade, top color=white,
    bottom color=blue!50!black!20, draw=blue!40!black!60, very
    thick }
    ]

\node[punkt, text width=5.5em] {Country~\B}
    %Lower part lv1
    child {
        node[punkt] [rectangle split, rectangle split, rectangle split parts=3,
         text ragged] {
            \textbf{Scenario  1}
                  \nodepart{second}
            $\text{Country \B}\colon    s\bar{Q}$
                  \nodepart{third}
            $\text{Country \A}\colon\pa{1-s}\bar{Q}$
        }
        edge from parent
            node[kant, below, pos=.6] {Unchanged parity}
    }
    %Upper part, lv1
    child {
        node[punkt, text width=6em] {Country~\A}
        %child 1
        child {
            node [punkt,rectangle split, rectangle split,
            rectangle split parts=3] {
                \textbf{Scenario  2}
                \nodepart{second}
                $\text{Country \B}\colon s\bar{Q}+2\alpha\Delta E -sc$
                \nodepart{third}
                $\text{Country \A}\colon\pa{1-s}\bar{Q}-\alpha\Delta E -
                \pa{1-s}c$
            }
            edge from parent
                node[below, kant,  pos=.6] {Unchanged parity}
        }
        %child 2
        child {
            node [punkt, rectangle split, rectangle split parts=3]{
                \textbf{Scenario 3}
                \nodepart{second}
                $\text{Country \B}\colon s\bar{Q}-2sc$
                \nodepart{third}
                $\text{Country \A}\colon\pa{1-s}\bar{Q}-2\pa{1-s}c$
            }
            edge from parent
                node[kant, above] {Devalues}}
            edge from parent{
                node[kant, above] {Devalues}}
    };
\end{tikzpicture}
\end{document}

Comments

  • #1 Carolina, January 24, 2010 at 3:42 p.m.

    I build a tree diagram myself using the structure above. There is just a problem. The tikzpicture is defined in the very beginning. But my tree is asymmetric because the upper branch just has two levels. This second level in my upper branch should have the same layout (in terms of siblings distance & level distance) as the fourth level in the lower branches.

    How can you redefine siblings distance & level distance for a specific branch?

    I appreciate your help! I can send you the tex code to make my problem clearer. (I wasn't able to post the tex-code due to the 3000 characters limit.)

  • #2 Tobias Mueller, August 24, 2010 at 10:21 a.m.

    I can't compile the .tex: (/usr/share/texmf/tex/context/base/supp-pdf.tex [Loading MPS to PDF converter (version 2006.09.02).] )

    ! Package tikz Error: I do not know what to do with the option ``level 1/.style ={sibling distance=3.5cm,level distance=5.2cm}''.

    See the tikz package documentation for explanation. Type H for immediate help. ...

    l.22 ]

    ?

  • #3 Vegar, October 23, 2013 at 11:12 a.m.

    Is there an easy way to fade branches of the tree while the rest remains un-faded?

Adding comments is currently not enabled.