 Finance - Maple Programming Help

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

Finance

 TrinomialTree
 construct a recombining trinomial tree

 Calling Sequence TrinomialTree(G, S, ${P}_{u}$, ${P}_{d}$, ${P}_{m}$, opts) TrinomialTree(T, S, ${P}_{u}$, ${P}_{d}$, ${P}_{m}$, opts) TrinomialTree(T, N, ${S}_{0}$, ${S}_{u}$, ${P}_{u}$, ${S}_{d}$, ${P}_{d}$, ${P}_{m}$, opts)

Parameters

 G - time grid data structure; time grid S - Array or list; state space of the discretized process ${P}_{u}$ - non-negative constant or operator; probability of moving to the upper descendant in the tree ${P}_{d}$ - non-negative constant or operator; probability of moving to the lower descendant in the tree ${P}_{m}$ - (optional) non-negative constant or operator; probability of moving to the middle descendant in the tree T - positive; stopping time N - posint; number of times steps ${S}_{0}$ - positive constant; initial value ${S}_{u}$ - positive constant; upward movement ${S}_{d}$ - positive constant; downward movement opts - (optional) equation(s) of the form option = value where option is mutable; specify options for the TrinomialTree command

Options

 • mutable = truefalse -- This option specifies whether the tree should be mutable or not. The default is true.

Description

 • The TrinomialTree(G, S, ${P}_{u},{P}_{d},{P}_{m}$, opts) calling sequence constructs a recombining trinomial tree approximating a certain stochastic process. This can be a GeometricBrownianMotion or a mean-reverting process such as OrnsteinUhlenbeckProcess or GaussMarkovProcess. The constructed tree will be based on the discretizations of the time and the state spaces given by G and S.
 • Assume that the time grid G consists of $N$ points ${T}_{1}$, ${T}_{1}$, ..., ${T}_{N}$. Then the resulting trinomial tree will have $N$ levels, each level representing possible states of the discretized process at time ${T}_{i}$, $i=1..N$. The parameter S contains all possible states of the discretized process. The number of elements of S should be equal to $2N-1$, and the elements of S must be sorted in descending order.
 • At level $i$, $i=1..N$ the tree has $i$ nodes, ${S}_{i,1}$, ..., ${S}_{i,i}$. Each node ${S}_{i,j}$ has three descendants at level $i+1$, ${S}_{i+1,j}$ (the upper descendant), ${S}_{i+1,j+1}$ (the middle descendant), and ${S}_{i+1,j+2}$ (the lower descendant). The initial state of the underlying process will be equal to ${S}_{N}$. The states of the underlying at the level $i$ are ${S}_{N-i}$, ..., ${S}_{N-1}$, ${S}_{N}$, ${S}_{N+1}$, ..., ${S}_{N+i}$.
 • The transition probabilities (i.e. the probability of going from ${S}_{i,j}$ to ${S}_{i+1,j}$, the probability of going from ${S}_{i,j}$ to ${S}_{i+1,j+1}$, and the probability of going from ${S}_{i,j}$ to ${S}_{i+1,j+2}$) are defined by ${P}_{u}$, ${P}_{d}$ and ${P}_{m}$. The parameter ${P}_{m}$ is optional. By default, the middle probability is calculated so that the total sum of all three probabilities is equal to $1$, that is, ${P}_{m}$ is set to $1-{P}_{d}-{P}_{u}$.
 • The parameters ${P}_{u}$, ${P}_{d}$, and ${P}_{m}$ can be either non-negative real constants or one-parameter operators. If ${P}_{u}$, ${P}_{d}$, or ${P}_{m}$ is given in the operator form the corresponding transition probability at level $i$ will be calculated as ${P}_{u}\left(\mathrm{dt}\right)$, ${P}_{d}\left(\mathrm{dt}\right)$, or ${P}_{m}\left(\mathrm{dt}\right)$ respectively, where $\mathrm{dt}={T}_{i+1}-{T}_{i}$.
 • The TrinomialTree(T, S, ${P}_{u},{P}_{d},{P}_{m}$, opts) calling sequence is similar except that in this case a uniform time grid with step size $\frac{T}{N}$ is used instead of G. In this case $N$ will be deduced from the size of the state array S.
 • Finally, TrinomialTree(T, N, ${S}_{0},{S}_{u},{P}_{u},{S}_{d},{P}_{d},{P}_{m}$, opts) calling sequence will construct a trinomial tree based on a uniform time grid with step size $\frac{T}{N}$. Each tree node ${S}_{i,j}$ will have two descendants ${S}_{i+1,j}={S}_{i,j}{S}_{u}$ (the upper descendant) and ${S}_{i+1,j+1}={S}_{i,j}{S}_{d}$ (the lower descendant). The transition probabilities will be calculated the same way as above.
 • The resulting data structure can be further manipulated using the Finance[SetUnderlying] and Finance[SetProbabilities] commands.

Examples

 > with(Finance):
 > S := [7.9, 7.5, 7.1, 6.5, 5., 3.7, 3.3, 2.95, 2.8];
 ${S}{≔}\left[{7.9}{,}{7.5}{,}{7.1}{,}{6.5}{,}{5.}{,}{3.7}{,}{3.3}{,}{2.95}{,}{2.8}\right]$ (1)
 > T := TrinomialTree(3, S, .3, .7):

Here are three different views of the same tree. The first one uses the standard scale, the second one uses the logarithmic scale, and the third one uses the exponential scale.

 > TreePlot(T, thickness = 2, axes = BOXED, gridlines = true); > TreePlot(T, thickness = 2, axes = BOXED, gridlines = true, color = red..blue, scale = logarithmic); > TreePlot(T, thickness = 2, axes = BOXED, gridlines = true, color = red..blue, scale = exponential); Inspect the tree.

 > GetUnderlying(T, 5, 1);
 ${7.900000000}$ (2)
 > GetProbabilities(T, 3, 1);
 $\left[{0.3000000000}{,}{0.}{,}{0.7000000000}\right]$ (3)

Change the value of the underlying at the uppermost node on level 5 and compare the two trees.

 > P1 := TreePlot(T, thickness = 2, axes = BOXED, gridlines = true):
 > SetUnderlying(T, 5, 1, 8.5);
 > P2 := TreePlot(T, thickness = 2, axes = BOXED, color = red, gridlines = true):
 > plots[display](P1, P2); Here is the same example as before but using a non-homogeneous time grid.

 > G := TimeGrid([0, 1.5, 2.0, 2.5, 3.0]);
 ${G}{:=}{\mathbf{module}}\left({}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end module}}$ (4)
 > S := [7.9, 7.5, 7.1, 6.5, 5., 3.7, 3.3, 2.95, 2.8];
 ${S}{≔}\left[{7.9}{,}{7.5}{,}{7.1}{,}{6.5}{,}{5.}{,}{3.7}{,}{3.3}{,}{2.95}{,}{2.8}\right]$ (5)
 > T := TrinomialTree(G, S, .3, .7):

Here are three different views of the same tree. The first one uses the standard scale, the second one uses the logarithmic scale, and the third one uses the exponential scale.

 > TreePlot(T, thickness = 2, axes = BOXED, gridlines = true); > TreePlot(T, thickness = 2, axes = BOXED, gridlines = true, color = red..blue, scale = logarithmic); > TreePlot(T, thickness = 2, axes = BOXED, gridlines = true, color = red..blue, scale = exponential); Inspect the tree.

 > GetUnderlying(T, 5, 1);
 ${7.900000000}$ (6)
 > GetProbabilities(T, 3, 1);
 $\left[{0.3000000000}{,}{0.}{,}{0.7000000000}\right]$ (7)

Change the value of the underlying at the uppermost node on level 5 and compare the two trees.

 > P1 := TreePlot(T, thickness = 2, axes = BOXED, gridlines = true):
 > SetUnderlying(T, 5, 1, 8.5);
 > P2 := TreePlot(T, thickness = 2, axes = BOXED, color = red, gridlines = true):
 > plots[display](P1, P2); In this example you will use the third construction.

 > Su := 1.1;
 ${\mathrm{Su}}{≔}{1.1}$ (8)
 > Sd := .95;
 ${\mathrm{Sd}}{≔}{0.95}$ (9)
 > T := TrinomialTree(3, 20, 100, Su, .3, Sd, .7):

Here are two different views of the same tree. The first one uses the standard scale, the second one uses the logarithmic scale.

 > TreePlot(T, thickness = 2, axes = BOXED, gridlines = true); > TreePlot(T, thickness = 2, axes = BOXED, gridlines = true, color = red..blue, scale = logarithmic); Inspect the tree.

 > GetUnderlying(T, 5, 1);
 ${146.4100000}$ (10)
 > GetProbabilities(T, 3, 1);
 $\left[{0.3000000000}{,}{0.}{,}{0.7000000000}\right]$ (11)

Change the value of the underlying at the uppermost node on level 5 and compare the two trees.

 > P1 := TreePlot(T, thickness = 2, axes = BOXED, gridlines = true):
 > for i from 1 to 20 do SetUnderlying(T, i, i, 100*(0.9)^(i-1)); end do;
 > P2 := TreePlot(T, thickness = 2, axes = BOXED, color = red, gridlines = true):
 > plots[display](P1, P2); References

 Brigo, D., Mercurio, F., Interest Rate Models: Theory and Practice, New York: Springer-Verlag, 2001.
 Glasserman, P., Monte Carlo Methods in Financial Engineering, New York: Springer-Verlag, 2004.
 Hull, J., Options, Futures, and Other Derivatives, 5th. edition. Upper Saddle River, New Jersey: Prentice Hall, 2003.
 Hull, J., and White, A., Numerical Procedures for Implementing Term Structure Models I: Single-Factor Models, Journal of Derivatives, 1994, 7-16.
 Hull, J., and White, A., Using Hull-White Interest Rate Trees, Journal of Derivatives, 1996, 26-36.

Compatibility

 • The Finance[TrinomialTree] command was introduced in Maple 15.