# How to replicate a probability tree with tikz?

I want to replicate the following probability tree in tikz. My problem so far was that the nodes of different third level branches joined.

Furthermore, how can I add the text to the branches, such that it is plain horizontal and not in direction of the branch?

Is there anyone who can help me on this?

• What did you try so far? Please provide a MWE (minimal working example, i.e., a complete but small latex document) that demonstrates the problems you encounter. In this case you might need to look into the child{ node {}} syntax of Tikz in combination with sibling distance and level distance options. See texample.net/tikz/examples/feature/trees for various examples. Oct 14 '15 at 8:56

Here's a forest solution:

For an introduction to forest and the bracket notation it uses to specify trees, see the second part of my answer to an earlier question.

Code:

\documentclass[tikz,border=10pt]{standalone}
\usepackage{forest}
\begin{document}
\tikzset{
labelling/.style={inner sep=1.5pt, font=\footnotesize\sffamily, align=left}
}
\begin{forest}
make label/.style={
if n=1{
edge label={node[midway, below, anchor=north east, labelling] {#1}}
}{
edge label={node[midway, above, labelling, anchor=south east] {#1}}
}
},
for tree={
grow=east,
l sep+=15mm,
parent anchor=east,
child anchor=west,
delay={
if n children=0{
if content={}{}{
labelling,
anchor=west,
for parent={
tier=not quite terminus,
for tree={
calign=midpoint
},
},
}
}{
shape=coordinate
}
},
}
[, for tree={calign=fixed edge angles}, tikz={\draw [densely dashed] (!11) +(0,-7.5mm) node [below, labelling] {once per day} -- (!ll) -- +(0,7.5mm);}
[, make label={Some event\\or other occurs\\sometime\\$p=\alpha$}
[
[Some further thing]
[And another one]
]
[, phantom]
]
[, make label={Some other\\event or other\\occurs sometime\\$p=1-\alpha$}
[, make label={Something\\$p=\delta$}
[Something here]
[Something else]
]
[, make label={Something else\\$p=1-\delta$}
[Some other thing]
[Another thing else]
]
]
]
\end{forest}
\end{document}
• Thank you very much! This is an excellent approach and solved my problem completely! Oct 19 '15 at 11:31
• @SimonZ. You're welcome. I like trees ;).
– cfr
Oct 19 '15 at 12:53