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: spdbl EBBS volsurf

Quantlet: SPDlp
Description: computes the State-Price Density for European options using the result of Breeden and Litzenberger.

Reference(s):

Usage: {spd,delta,gamma,band}=SPDlp(RawData,xGrid, locband, metric{,spdMaturity,IR,ForwardPrice})
Input:
RawData n x 6 data matrix, where the first column contains the forward prices, the second the strikes, the third the interest rates, the fourth maturities [in years], the fifth the option prices and the sixth contains the types of the options (1 means a call, 0 a put). The raw data may correspond either to a whole surface or only to a given smile.
xGrid m x 1 vector of moneyness (or strikes) for which you want to estimate the State-Price density.
locband scalar, bandwidth for estimating the smile and its derivatives. The bandwidth can be global or local. If locband is chosen equal to 0, then the bandwidth is automatically chosen locally via the EBBS algorithm. If locband is negative then EBBS selects an optimal global bandwidth. Take care that the nonparametric estimation is done on standardized data.
metric scalar taking the values 0 or 1; specifies whether the State-Price density is contained in the original strike metric (metric=0) or in a the following moneyness metric (=Strike/ForwardPrice).
spdMaturity (optional) scalar containing the maturity for which you want to estimate the SPD. If the raw data correspond to a smile, then you do not need to use this parameter as it must be equal to the fourth column of the raw data.
IR (optional) interest rate corresponding to the maturity ("spdMaturity"). Is only used if the raw data correpond to a whole surface.
ForwardPrice (optional) scalar, represents the forward price of the underlying for the corresponding maturity ("spdMaturity").
Output:
spd m x 1 vector of SPD estimates on xgrid.
delta m x 1 vector of delta estimates on xgrid.
gamma m x 1 vector of gamma estimates on xgrid.
band m x 1 vector of selected bandwidths.

Note:

Example:
library("multi")
library("plot")
library("stats")
library("finance")
library("smoother")
data=read("XFGData9701.dat")
locband=-1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Estimating the SPD using only one smile!(here, the smile with a time
; to maturity less than one month.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
smile=paf(data,(data[,1]==3)&&(data[,4]==1)&&(data[,5]<30))
mat=smile[,5]./365
IR=smile[,9]
ForwardPrice=smile[,8].*exp(IR.*mat)
RawData=ForwardPrice~smile[,6]~IR~mat~smile[,7]~smile[,4]
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Estimating the SPD in a fixed maturity design using the whole surface
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
surface=paf(data,(data[,1]==3))
mat=surface[,5]./365
IR=surface[,9]
ForwardPrice=surface[,8].*exp(IR.*mat)
RawData=ForwardPrice~surface[,6]~IR~mat~surface[,7]~surface[,4]
; moneyness metric(=(Strike/ForwardPrice))
xGrid=grid(0.8,0.005,80)
result=SPDlp(RawData, xGrid, locband, 1,0.04,0.0315,2873.8)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
spdline=xGrid~result.fstar
spdline=setmask(spdline,"line","blue")
setsize(500,500)
d=createdisplay(1,1)
show(d,1,1,spdline)
setgopt(d,1,1,"title","SPD","ylabel","Density","xlabel","strike/Forward Price")
setgopt(d,1,1, "xvalue",0|1)

Result:
This example plots the SPD for the maturity of 0.04
years using all options data of 19970103. The metric is here
the moneyness one.
You may change the maturity (then you should also change IR and the
ForwardPrice).



Author: P. Kervella, W. Haerdle, 20020116 license MD*Tech
(C) MD*TECH Method and Data Technologies, 05.02.2006