question with Probability tree
Wu Zhang <[email protected]>
| Newsgroups | gmane.comp.tex.miktex |
|---|---|
| Message-ID | <[email protected]> |
Hi,
I found this file for probability tree:
\documentclass{article}
\usepackage[latin1]{inputenc}
\usepackage{tikz}
\usetikzlibrary{trees}
\usepackage{verbatim}
\begin{comment}
:Title: Probability tree
:Tags: Trees
A simple example of a probability tree diagram.
\end{comment}
\begin{document}
\pagestyle{empty}
% Set the overall layout of the tree
\tikzstyle{level 1}=[level distance=3.5cm, sibling distance=3.5cm]
\tikzstyle{level 2}=[level distance=3.5cm, sibling distance=2cm]
% Define styles for bags and leafs
\tikzstyle{bag} = [text width=4em, text centered]
\tikzstyle{end} = [circle, minimum width=3pt,fill, inner sep=0pt]
% The sloped option gives rotated edge labels. Personally
% I find sloped labels a bit difficult to read. Remove the sloped options
% to get horizontal labels.
\begin{tikzpicture}[grow=right, sloped]
\node[bag] {Bag 1 $4W, 3B$}
child {
node[bag] {Bag 2 $4W, 5B$}
child {
node[end, label=right:
{$P(W_1\cap W_2)=\frac{4}{7}\cdot\frac{4}{9}$}] {}
edge from parent
node[above] {$W$}
node[below] {$\frac{4}{9}$}
}
child {
node[end, label=right:
{$P(W_1\cap B_2)=\frac{4}{7}\cdot\frac{5}{9}$}] {}
edge from parent
node[above] {$B$}
node[below] {$\frac{5}{9}$}
}
edge from parent
node[above] {$W$}
node[below] {$\frac{4}{7}$}
}
child {
node[bag] {Bag 2 $3W, 6B$}
child {
node[end, label=right:
{$P(B_1\cap W_2)=\frac{3}{7}\cdot\frac{3}{9}$}] {}
edge from parent
node[above] {$B$}
node[below] {$\frac{3}{9}$}
}
child {
node[end, label=right:
{$P(B_1\cap B_2)=\frac{3}{7}\cdot\frac{6}{9}$}] {}
edge from parent
node[above] {$W$}
node[below] {$\frac{6}{9}$}
}
edge from parent
node[above] {$B$}
node[below] {$\frac{3}{7}$}
};
\end{tikzpicture}
\end{document}
You can find the link here: https://www.writelatex.com/402223pmfdhy
My
question is: how can we replace the fractions with a box or circle? I
am planning to put it as a question to students; I want them to fill out
the box or circles for the right probabilities.
Thanks,
Wu
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk