de¬ned by the user. The second row is the name of the quantlet returning

Jacobian of this term structure function. Both of these two quantlets have

only one parameter time t and it is necessary that they can use vectors. The

third row is the name of the function for the skew structure. It has one input

parameter S which is the spot price. If there is no term structure, but signi¬cant

skew structure, insert in the ¬rst row only an empty string: volafunc[1]="".

The following quantlet computes the state space of an ITT with signi¬cant

term and skew structure.

STFitt02.xpl

The state space is plotted in Figure 3.15. Now we hid the part which manages

about the plotting routines, this will be explained later.

The general form of ITT without the interactivity is

3.5 Computing Implied Trinomial Trees 77

{Ttree, P, Q, AD, LocVol, Onodes, Oprobs, Time} = ITT(S,

r, div,

time,volafunc{,skewconst})

where S is the spot price of the underlying at time t0 = 0, r and div are

compounded riskless interest rate and dividend yield (both of them ∈ (0, 1)).

time is vector of time points corresponding to the tree. They are to be given

in years and they are supposed to increase. The parameter volafunc has been

already described above and skewconst is an optional parameter which will be

discussed in Section 3.5.2. The output Ttree is a matrix containing the Implied

Trinomial Tree. Ttree[1,1] is the root and all elements which do not belong

to the tree are NaN™s. P and Q are matrices with the up and down transition

probabilities respectively, AD is a matrix containing the Arrow-Debreu prices for

the computed tree and LocVol is a matrix with implied local volatilities. If there

were some violations of the forward condition (described in Subsection 3.4.4)

then Onodes is a matrix of NaN™s with the same dimensions like Ttree, but on

the places of the overwritten nodes is their value. If there were no overwritten

nodes Onodes is only scalar (=NaN). Oprobs is a matrix with two columns

containing x- and y-coordinates of the nodes, where a probability violated the

second condition from Section 3.4.4. If there were none, Oprobs is equal to

NaN. But for each probability causing an overwrite, four rows are appended to

the ¬rst auxiliary row 0˜0. First row of this quartet is the parental node where

overwrite occurred, the three other rows are corresponding daughter nodes.

Time is the same as the input parameter time, if there is no signi¬cant term

structure. In other case it contains the solution of the equation system 3.17.

So if we change the parameter time from our last example: time=0|1|2, then

the variable impltree will contain these following components:

Table 3.1: Contents of impltree.Ttree

100 110.5 119.94

+NAN 103.97 112.18

+NAN 97.461 105.56

+NAN +NAN 98.944

+NAN +NAN 91.247

78 3 Implied Trinomial Trees

129.10

120.16

116.72

113.28

110.04

109.19

107.08

104.02

103.22

100.91

100.00

98.02

97.27

94.08

91.39

85.26

0.0000 0.6813 1.5289 3.0000

Figure 3.15: State Space with Signi¬cant Term and Volatility Structure.

Table 3.2: Contents of impltree.P

0.45353 0.67267

+NAN 0.72456

+NAN 0.70371

Table 3.3: Contents of impltree.Q

0.00053582 0.11468

+NAN 0.091887

+NAN 0.093641

STFitt03.xpl

3.5 Computing Implied Trinomial Trees 79

Table 3.4: Contents of impltree.AD

1 0.4123 0.24826

+NAN 0.4963 0.40038

+NAN 0.00048711 0.12417

+NAN +NAN 0.04091

+NAN +NAN 4.0831e-05

Table 3.5: Contents of impltree.LocVol

0.049924 0.040269

+NAN 0.036105

+NAN 0.04117

Table 3.6: Contents of impltree.Onodes

+NAN

The simplest way to display results is to use quantlet plotITT. It speci¬es

explicitly which components of the computed ITT should be plotted.

plotITT (itree, what{, r{, text{, prtext}}})

The input parameter itree is just the output parameter of the quantlet ITT,

i.e. a list containing Ttree, P, Q, AD, LocVol, Onodes, Oprobs and Time. what

is a vector determining, which plots will be displayed. It has up to 5 rows and

each non-zero tells XploRe that the corresponding plot should be shown. The

possible plots are in sequence: 1) state space of the given ITT, 2) trees with

transition probabilities, 3) the tree of local volatilities, 4) the tree of Arrow-