Financial Derivatives Toolbox    

Using BDT Trees in MATLAB

When working with the BDT model, the Financial Derivatives Toolbox uses trees to represent interest rates, prices, etc. At the highest level, these trees contain several MATLAB structures. The structures encapsulate information needed to interpret completely the information contained in a tree.

Because BDT trees are essentially MATLAB structures, you can examine their contents manually, just as you can for HJM trees. Consider this example, which uses the data in the MAT-file deriv.mat included in the toolbox.

Load the data into the MATLAB workspace.

Display the list of the variables loaded from the MAT-file.

Structure of a BDT Tree

You can now examine in some detail the contents of the BDTTree structure.

FwdTree contains the actual rate tree. It is represented in MATLAB as a cell array with each cell array element containing a tree level.

The other fields contain other information relevant to interpreting the values in FwdTree. The most important of these are VolSpec, TimeSpec, and RateSpec, which contain the volatility, rate structure, and time structure information respectively.

Look at the RateSpec structure used in generating this tree to see where these values originate. Arrange the values in a single array.

Look at the rates in FwdTree. The first node represents the valuation date, tObs = 0. The second node represents tObs = 1. Examine the rates at the second, third and fourth nodes.

The second node represents the first observation time, tObs = 1. This node contains a total of two states, one representing the branch going up (1.0979) and the other representing the branch going down (1.1432).

The third node represents the second observation time, tObs = 2. This node contains a total of three states, one representing the branch going up (1.0976), one representing the branch in the middle (1.1377) and the other representing the branch going down (1.1942).

The fourth node represents the third observation time, tObs = 3. This node contains a total of four states, one representing the branch going up (1.0872), two representing the branches in the middle (1.1183 and 1.1606) and the other representing the branch going down (1.2179).

Verifying Results with treepath

The function treepath isolates a specific node by specifying the path to the node as a vector of branches taken to reach that node. As an example, consider the node reached by starting from the root node, taking the branch up, then the branch down, and finally another branch down. Given that the tree has only two branches per node, branches going up correspond to a 1, and branches going down correspond to a 2. The path up-down-down becomes the vector [1 2 2].

treepath returns the short rates for all the nodes touched by the path specified in the input argument, the first one corresponding to the root node, and the last one corresponding to the target node.

Graphical View of Interest Rate Tree

The function treeviewer provides a graphical view of the path of interest rates specified in BDTTree. For example, load the file deriv.mat. Here is a treeviewer representation of the rates along several branches of BDTTree.

A previous example used treepath to find the path of interest rates taking the first branch up and then two branches down the rate tree.

The treeviewer function displays the same information obtained by clicking along the sequence of nodes, as shown next.


  Black-Derman-Toy Model (BDT) Pricing and Sensitivity from BDT