Finance - Maple Programming Help

Home : Support : Online Help : Mathematics : Finance : Lattice Methods : Finance/GetProbabilities

Finance

 GetProbabilities
 get probabilities of a tree node

 Calling Sequence GetProbabilities(T, i, j)

Parameters

 T - binomial or trinomial tree data structure i - positive integer; time step j - positive integer; node index

Description

 • At each level the nodes of a recombining tree are indexed from 1 to n (the number of tree nodes at this level), where 1 denotes the lowermost node and n denotes the uppermost node of the tree. The GetProbabilities command returns the list of transition probabilities for the node j at level i of the tree T. This command is related to the GetDescendants command in-as-much as the descendants  returned by GetDescendants and probabilities returned by GetProbabilities are ordered correspondingly.
 • Note that the transition probabilities can be set using the SetProbabilities command.

Examples

 > $\mathrm{with}\left(\mathrm{Finance}\right):$

First consider a trinomial tree approximating an Ornstein-Uhlenbeck process.

 > $X≔\mathrm{OrnsteinUhlenbeckProcess}\left(0.1,1.0,0.03,0.3\right)$
 ${X}{≔}{\mathrm{_X0}}$ (1)
 > $T≔\mathrm{ShortRateTree}\left(X,4,10\right)$
 ${T}{:=}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}$ (2)

Here is a plot of this tree.

 > $\mathrm{TreePlot}\left(T,\mathrm{thickness}=2,\mathrm{gridlines}=\mathrm{true}\right)$

Get descendants of the node 3 at level 3. The descendants belong to level 4.

 > $\mathrm{GetDescendants}\left(T,3,3\right)$
 $\left[{3}{,}{4}{,}{5}\right]$ (3)

Get the corresponding probabilities.

 > $\mathrm{GetProbabilities}\left(T,3,3\right)$
 $\left[{0.1507749899}{,}{0.6655866667}{,}{0.1836383434}\right]$ (4)

This means that the probability of moving from node (3, 3) to node (4, 2) is approximately 0.15, the probability of moving from node (3, 3) to node (4, 3) is approximately 0.66 and the probability of moving from node (3, 3) to node (4, 4) is approximately 0.18.

In this example, set transition probabilities of a tree.

 > $T≔\mathrm{TrinomialTree}\left(5,⟨1,2,3,4,5,6,7⟩\right)$
 ${T}{:=}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}$ (5)
 > $\mathrm{GetProbabilities}\left(T,3,3\right)$
 $\left[{0.3333333333}{,}{0.3333333334}{,}{0.3333333333}\right]$ (6)
 > $\mathrm{SetProbabilities}\left(T,3,3,\left[0.5,0.2,0.3\right]\right)$
 > $\mathrm{GetProbabilities}\left(T,3,3\right)$
 $\left[{0.5000000000}{,}{0.2000000000}{,}{0.3000000000}\right]$ (7)

Compatibility

 • The Finance[GetProbabilities] command was introduced in Maple 15.
 • For more information on Maple 15 changes, see Updates in Maple 15.