Library: | finance |
See also: | bitree IBTdk IBTbc IBTlocsigma IBTvolaplot |
Quantlet: | IBTsdisplot | |
Description: | plots a smoothed estimation of the implied probability distribution estimated by implied binomial tree |
Usage: | mf = IBTsdisplot(dat, bandwidth) | |
Input: | ||
dat | matrix: two columns, the first column contains the stock prices of different nodes at a given level, the second column the probability taken at the corresponding nodes | |
bandwidth | scalar: the bandwidth for estimating the density function | |
Output: | ||
mf | matrix: two columns, the first column is a grid and the second column contains the density estimation on that grid |
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=20 ; the number of time steps expiration=5 ; time to expiration ibtree=IBTbc(S, r, lev, expiration, "volafunc") dat=ibtree.Tree[,lev+1]~ibtree.lb[,lev+1]*exp(r*expiration) bandwidth=10 mf=IBTsdisplot(dat, bandwidth)
Output is a density estimation plot of the implied risk-neutral stock price distribution at fifth year, which is computed from the implied binomial tree.