Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Library: finance
See also: IBTdk IBTbc IBTresort

Quantlet: IBTnicemat
Description: shows the title and a string representation of the input matrix where each element has a fixed number of digits. Zeros are replaced by blanks.

Usage: IBTnicemat(title, matr, n)
Input:
title String: the name desired for the output array
matr Matrix: input matrix
n Scalar: the number of fixed digits desired

Example:
library("finance")
matr=#(1,0,0)~#(2,3,0)~#(4,5,6)
matr
T=IBTresort(matr)
T
IBTnicemat("outputmatrix", T, 1)

Result:
Contents of matr

[1,]        1        2        4
[2,]        0        3        5
[3,]        0        0        6

Contents of T

[1,]        0        0        6
[2,]        0        3        0
[3,]        1        0        5
[4,]        0        2        0
[5,]        0        0        4

outputmatrix
.	              6.0
.	        3.0
.	  1.0         5.0
.	        2.0
.	              4.0
Example:
library("finance")
proc(sigma)=volafunc(K, S, time)
  sigma=0.1+(S-K)/S/10*0.5
endp
r=0.03		; riskless annual interest rate
S=100		; the underlying asset price
lev=3		; the number of time steps
expiration=3	; time to expiration
ibtree=IBTdk(S,r, lev, expiration, "volafunc")
ptree=IBTresort(ibtree.Tree)
prob=IBTresort(ibtree.prob)
lb=IBTresort(ibtree.lb)
IBTnicemat("stock price", ptree, 3)
IBTnicemat("transition probability", prob, 3)
IBTnicemat("Arrow-Debreu price", lb, 3)

Result:
The following three matrices:


stock price
.	                                130.124
.	                      120.312
.	            110.523             110.650
.	  100.000             100.000
.	             90.479              90.375
.	                       79.292
.	                                 71.273

transition probability
.	                  0.684
.	          0.684
.	  0.627           0.625
.	          0.673
.	                  0.546
.
.
Arrow-Debreu price
.	                          0.268
.	                  0.404
.	          0.608           0.380
.	  1.000           0.423
. 	          0.362           0.215
.	                  0.115
.	                          0.051



Author: J. Zheng, W. Haerdle, 20010605 license MD*Tech
(C) MD*TECH Method and Data Technologies, 05.02.2006