Library: | finance |
See also: | bitree IBTdk IBTbc IBTvolaplot |
Quantlet: | IBTlocsigma | |
Description: | estimates the implied local volatility of each node in the implied binomial tree |
Usage: | loc = IBTlocsigma(ptree, prob, m, deltat) | |
Input: | ||
ptree | Matrix: the first j elements in the jth column are corresponding to the stock prices of the nodes at the (j-1)th level in the implied tree generated by IBTdk or IBTbc | |
prob | Matrix: the first j elements in jth column are corresponding to the transition probability of the nodes at the (j-1)th level in the implied tree generated by IBTdk or IBTbc | |
m | scalar: the highest level desired | |
deltat | scalar: the length of time step (by year) | |
Output: | ||
loc | Matrix: 3 columns, the first column contains the stock price at some node in implied binomial tree, the second column the time to expiration and the third column the estimated implied local volatility |
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=4 ; the number of time steps expiration=2 ; time to expiration deltat=expiration/lev ibtree=IBTdk(S, r, lev, expiration, "volafunc") ptree=ibtree.Tree prob=ibtree.prob m=2 loc=IBTlocsigma(ptree, prob,m, deltat) loc
Contents of loc [ 1,] 100 0.5 0.069598 [ 2,] 100 1 0.09829 [ 3,] 93.171 0.5 0.075124 [ 4,] 93.171 1 0.10566 [ 5,] 107.33 0.5 0.064462 [ 6,] 107.33 1 0.090728 [ 7,] 85.645 0.5 0.080028 [ 8,] 85.645 1 0.11355 [ 9,] 100 0.5 0.069959 [10,] 100 1 0.098629 [11,] 114.26 0.5 0.059354 [12,] 114.26 1 0.083493 [13,] 79.293 0.5 0.085862 [14,] 93.139 0.5 0.075195 [15,] 107.37 0.5 0.064605 [16,] 121.32 0.5 0.05425