Ich versuche, in LaTeX diesen Wahrscheinlichkeitsbaum zu erstellen:
Ich habe versucht, das tikz
Paket zu verwenden, aber ich habe immer wieder Probleme. Dies ist das Beste, was ich bisher bekommen habe (Link:https://www.writelatex.com/855538qcgkps#/1917915/):
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{trees}
\begin{document}
\pagestyle{empty}
\tikzstyle{level 1}=[level distance=3cm, sibling distance=3cm]
\tikzstyle{level 2}=[level distance=3.5cm, sibling distance=2cm]
\tikzstyle{bag} = [circle, minimum width=10pt, inner sep=2pt]
\tikzstyle{end} = [circle, minimum width=3pt, fill, inner sep=0pt]
\begin{tikzpicture}[grow=right, sloped]
\node[bag]{}
child {
node[bag] {O}
child {
node[end, label=right:{O}] {}
edge from parent
node[above] {}
node[below] {$1-\lambda$}
child {
node[end, label=right: {O ...}] {}
edge from parent
node[above] {}
node[below] {$1-\lambda$}
}
child {
node[end, label=right: {S ...}] {}
edge from parent
node[above] {$\lambda$}
node[below] {}
}
}
child {
node[end, label=right: {S}] {}
edge from parent
node[above] {$\lambda$}
node[below] {}
}
edge from parent
node[above] {}
node[below] {$1-\lambda$}
}
child {
node[bag] {S}
child {
edge from parent
node[above] {1}
node[below] {}
node[bag] {O'}
child {
edge from parent
node[above] {$1$}
node[below] {$$}
edge from parent
}
}
edge from parent
node[above] {$\lambda$}
node[below] {}
};
\end{tikzpicture}
\end{document}
Wie Sie sehen, sind sie ziemlich unterschiedlich, aber ich komme nicht weiter. Können Sie mir helfen? Ich kann die Fehler einfach nicht erkennen.
Am besten.
Antwort1
Ich empfehle Ihnen die Verwendung des leistungsstarkenforest
Paket (basiert auf PGF/TikZ):
\documentclass{article}
\usepackage{amsmath}
\usepackage{forest}
\tikzset{
dot/.style={circle,draw,inner sep=1.2,fill=black},
}
\newcommand\Labeli{%
node[below left,midway,xshift=3pt,font=\small]{$(1-\lambda)$}
node[above right,midway,xshift=-3pt,font=\small]{$0$}%
}
\newcommand\Labelii{%
node[above left,midway,xshift=3pt,font=\small]{$S$}
node[below right,midway,xshift=-3pt,font=\small]{$(\lambda)$}%
}
\newcommand\Labeliii{%
node[above,midway,font=\small]{$0'$}
node[below,midway,font=\small]{$(1)$}%
}
\begin{document}
\begin{forest}
[ ,name=a,for tree={s sep=60pt,l sep=2cm,dot,grow=0},
[ ,name=b,edge label={\Labeli}
[ ,name=c,edge label={\Labeli}
[ ,name=d,edge label={\Labeli} ]
[ ,name=e,edge label={\Labelii} ]
]
[ ,edge label={\Labelii}
[ ,name=f,edge label={\Labeliii} ]
]
]
[ ,edge label={\Labelii}
[ ,edge label={\Labeliii}
[ ,name=g,edge label={\Labeliii} ]
]
]
]
\foreach \Nodo in {d,e,f,g}
\node[anchor=west,xshift=3pt] at (\Nodo) {$\cdots$};
\node[yshift=-1cm,name= tiii,font=\small] at (d) {$t+3$};
\node[name= tii,font=\small] at (c|-tiii) {$t+2$};
\node[name= ti,font=\small] at (b|-tiii) {$t+1$};
\node[name= t,font=\small] at (a|-tiii) {$t$};
\end{forest}
\end{document}