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: spdbs lpregxest lpderxest greeks

Quantlet: spdbl
Description: Uses the Breeden and Litzenberger (1978) method and a semiparametric specification of the Black-Scholes option pricing function to calculate the empirical State Price Density. The analytic formula uses an estimate of the volatility smile and its first and second derivative to calculate the State-price density, as well as Delta and Gamma of the option. This method can only be applied to European options (due to the assumptions).

Reference(s):

Usage: lpspd = spdbl(m, sigma, sigma1, sigma2, s, r, tau)
Input:
m N x 1 vector of moneyness (St-Div)/K (= the underlying spot price corrected for dividends divided by the strike price). The spot price must be corrected for the dividends which may occur between today and today + "tau".
sigma N x 1 vector of points of the estimated volatility smile.
sigma1 N x 1 vector of points of the first derivative of the volatility smile (with respect to the moneyness defined above).
sigma2 N x 1 vector of points of the second derivative of the volatility smile (with respect to the moneyness defined above)
s N x 1 vector, underlying spot price corrected for dividends
r N x 1 vector, risk-free interest rate
tau N x 1 vector, time to maturity
Output:
lpspd.fstar N x 1 vector of state-price density
lpspd.delta N x 1 vector of option deltas
lpspd.gamma N x 1 vector of option gammas

Example:
library("finance")
data=read("XFGJan1997")
names=readm("XFGkeyJan1997")
date=names.text[,1]
type=names.text[,2]
l=list(date,type,data)
ind=(l.date=="02.01.1997")&&(l.data[,2]==0.25)&&(l.type=="C")
smdata=paf(l.data,ind)
vola=smdata[,1]
tau=smdata[,2]
m=smdata[,3]
r=smdata[,4]./100
s=smdata[,5]
div=0
F=s.*exp((r-div).*tau)
K=m.*F
newm =(s.*exp(-div.*tau))./K
data=newm~vola
;create a grid to estimate the volatility smile
bw=0.001
m2=grid(min(newm),bw,(max(newm)-min(newm))/bw+1)
hh=0.2
mh=lpregxest(data,hh,2,m2)
mh1=lpderxest(data,hh,1,2,m2)	; the first derivative of the volatility
mh2=lpderxest(data,hh,2,2,m2)	; the second derivative of the volatility
lpspd=spdbl(mh[,1], mh[,2], mh1[,2], mh2[,2], mean(s), mean(r), mean(tau))
spd=(mean(s)./m2)~(lpspd.fstar)
delta=(m2)~(lpspd.delta)
;plot local polynomial SPD
meanmf=max(spd[,2])
measure=10^(floor(log10(meanmf))+1)
res1 = setmask(spd, "line","red")
res2 = setmask(delta, "line","blue","dashed")
d=createdisplay(2,1)
show(d,1,1,res1)
title="Semi-parametric SPD: 02-01-1997 tau=0.25"
xlabel="stock price"
ylabel="density"
setgopt(d,1,1,"title",title,"xlabel",xlabel,"ylabel",ylabel)
setgopt(d,1,1, "xvalue",0|1,"yvalue",0|measure)
show(d,2,1,res2)
title="Semi-parametric Delta: 02-01-1997 tau=0.25"
xlabel="Moneyness(St/K)"
ylabel="delta"
setgopt(d,2,1,"title",title,"xlabel",xlabel,"ylabel",ylabel)
setgopt(d,2,1, "xvalue",0|1,"yvalue",0|measure)

Result:
State-Price Density, Delta and Gamma are calculated using
the local polynomial regression for January 2, 1997 with a
time-to-maturity (tau) of 0.25 years. Plots are produced
showing the local polynomial SPD and Delta.



Author: K. Huynh, P. Kervella, J. Zheng, W. Haerdle, 20011114 license MD*Tech
(C) MD*TECH Method and Data Technologies, 05.02.2006