Game Trees with ‘egameps’

I have spent a few hours over the last couple of days figuring out how to draw game and / or decision trees in \LaTeX.  As always, some creative googling and hours of tinkering showed me the way. My initial searches yielded a few \LaTeX packages focused on drawing trees, like parsetree, qtree, syntree and xyling packages. Unfortunately, all were constructed with linguists in mind. None seemed to have the capabilities to represent information sets. This, naturally, is a significant drawback for those looking to draw the extended forms of simultaneous move games.

The linguistic packages yielded trees like the one below.  Note that I was not able to show player 2’s options as belonging to the same information set.

A Game Tree using the xyling package

Yesterday, I was quite happy with the linguistic packages.  Today, I figured that it might be beneficial to play around a bit and figure out how to represent the information sets.  Some more googling and I discovered Martin J. Osborne’s egameps package.  This was exactly what I needed: written by an economist for economists.

A Game Tree using the egameps package

The tree looks similar, except I am able to draw a labelled dotted line marking the player 2’s information set.  It’s likely that I could draw the identical tree with the linguistic packages, but egameps seems more intuitive.  It also took me less time to parse the code.  Which, by the way, is

\begin{egame}(800,420)          % (box dimension)
\putbranch(400,360)(2,1){300}   % (node coordinate)(x-y scale){length (in x units}
    \iib{Player 1}{$H$}{$T$}    % \# nodes{node label}{left arm label}{right arm label}
\putbranch(100,210)(1,1){150}
    \iib{}{$H$}{$T$}[$-1,1$] [$1,-1$] % [left arm payoff][right arm payoff]
\putbranch(700,210)(1,1){150}
    \iib{}{$H$}{$T$}[$-1,1$] [$1,-1$]
\infoset(100,210){600}{Player 2}% (left coordinate){length}{label}
\end{egame}

The comments describe the various arguments.  For example, the comment in line 2 describes the three arguments associated with \putbranch.  The ordering of the arguments and the bracket types are identical in the code and in the associated comment.

Useless bit of information for the day: Linguists spend a lot of their time drawing trees.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: