Learn R Programming

RND (version 1.1)

MOE: Mother of All Extractions

Description

MOE function extracts the risk neutral density based on all models and summarizes the results.

Usage

MOE(market.calls, call.strikes, market.puts, put.strikes, call.weights = 1, put.weights = 1, lambda = 1, s0, r, te, y, file.name = "myfile")

Arguments

market.calls
market calls (most expensive to cheapest)
call.strikes
strikes for the calls (smallest to largest)
market.puts
market calls (cheapest to most expensive)
put.strikes
strikes for the puts (smallest to largest)
call.weights
Weights for the calls (must be in the same order of calls)
put.weights
Weights for the puts (must be in the same order of puts)
lambda
Penalty parameter to enforce the martingale condition
s0
Current asset value
r
risk free rate
te
time to expiration
y
dividend yield
file.name
File names where analysis is to be saved. SEE DETAILS!

Value

bsm.mu
mean of log(S(T)), when S(T) is lognormal
bsm.sigma
SD of log(S(T)), when S(T) is lognormal
gb.a
extracted power parameter, when S(T) is assumed to be a GB rv
gb.b
extracted scale paramter, when S(T) is assumed to be a GB rv
gb.v
extracted first beta paramter, when S(T) is assumed to be a GB rv
gb.w
extracted second beta parameter, when S(T) is assumed to be a GB rv
mln.alpha.1
extracted proportion of the first lognormal. Second one is 1 - alpha.1 in mixture of lognormals
mln.meanlog.1
extracted mean of the log of the first lognormal in mixture of lognormals
mln.meanlog.2
extracted mean of the log of the second lognormal in mixture of lognormals
mln.sdlog.1
extracted standard deviation of the log of the first lognormal in mixture of lognormals
mln.sdlog.2
extracted standard deviation of the log of the second lognormal in mixture of lognormals
ew.sigma
volatility when using the Edgeworth expansions
ew.skew
normalized skewness when using the Edgeworth expansions
ew.kurt
normalized kurtosis when using the Edgeworth expansions
a0
extracted constant term in the quadratic polynomial of Shimko method
a1
extracted coefficient term of k in the quadratic polynomial of Shimko method
a2
extracted coefficient term of k squared in the quadratic polynomial of Shimko method

Details

The MOE function in a few key strokes extracts the risk neutral density via various methods and summarizes the results.

This function should only be used for European options.

NOTE: Three files will be produced: filename will have the pdf version of the results. file.namecalls.csv will have the predicted call values. file.nameputs.csv will have the predicted put values.

References

E. Jondeau and S. Poon and M. Rockinger (2007): Financial Modeling Under Non-Gaussian Distributions Springer-Verlag, London

Examples

Run this code

###
### You should see that all methods extract the same density!
###

r     = 0.05
te    = 60/365
s0    = 1000
sigma = 0.25
y     = 0.02

strikes     = seq(from = 500, to = 1500, by = 5)
bsm.prices  = price.bsm.option(r =r, te = te, s0 = s0, 
              k = strikes, sigma = sigma, y = y)

calls   = bsm.prices$call
puts    = bsm.prices$put

###
### See where your results will go...
###

getwd()


###
###  Running this may take 1-2 minutes...
###
### MOE(market.calls = calls, call.strikes = strikes, market.puts = puts, 
###    put.strikes = strikes, call.weights = 1, put.weights = 1, 
###    lambda = 1, s0 = s0, r = r, te = te, y = y, file.name = "myfile")
###
### You may get some warning messages.  This happens because the
###    automatic initial value selection sometimes picks values
###    that produce NaNs in the generalized beta density estimation.
###    These messages are often inconsequential.
###

Run the code above in your browser using DataLab