Learn R Programming

RND (version 1.2)

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

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