parsiad.ca - Monte Carlo simulation framework









Search Preview

Monte Carlo simulations in GNU Octave financial package - Parsiad Azimzadeh

parsiad.ca

.ca > parsiad.ca

SEO audit: Content analysis

Language Error! No language localisation is found.
Title Monte Carlo simulations in GNU Octave financial package - Parsiad Azimzadeh
Text / HTML ratio 53 %
Frame Excellent! The website does not use iFrame solutions.
Flash Excellent! The website does not have any flash contents.
Keywords cloud = Octave GNU financial SDE package pricing Carlo Timesteps Monte X_t dt problem stopping call Simulations Optimal BlackScholes Azimzadeh motion
Keywords consistency
Keyword Content Title Description Headings
= 32
Octave 11
GNU 11
financial 8
SDE 7
package 7
Headings
H1 H2 H3 H4 H5 H6
1 6 6 0 0 0
Images We found 2 images on this web page.

SEO Keywords (Single)

Keyword Occurrence Density
= 32 1.60 %
Octave 11 0.55 %
GNU 11 0.55 %
financial 8 0.40 %
SDE 7 0.35 %
package 7 0.35 %
pricing 6 0.30 %
Carlo 6 0.30 %
Timesteps 5 0.25 %
Monte 5 0.25 %
X_t 4 0.20 %
dt 4 0.20 %
problem 4 0.20 %
stopping 4 0.20 %
call 4 0.20 %
Simulations 4 0.20 %
Optimal 4 0.20 %
BlackScholes 3 0.15 %
Azimzadeh 3 0.15 %
motion 3 0.15 %

SEO Keywords (Two Word)

Keyword Occurrence Density
GNU Octave 9 0.45 %
financial package 7 0.35 %
Octave financial 7 0.35 %
Monte Carlo 5 0.25 %
Optimal stopping 4 0.20 %
Parsiad Azimzadeh 3 0.15 %
in GNU 3 0.15 %
Brownian motion 3 0.15 %
pricing a 3 0.15 %
= 40 3 0.15 %
pricing problem 3 0.15 %
is the 3 0.15 %
and the 3 0.15 %
Selected publications 3 0.15 %
with the 3 0.15 %
exp r 2 0.10 %
= 05 2 0.10 %
= 100 2 0.10 %
X_0 = 2 0.10 %
Test parameters 2 0.10 %

SEO Keywords (Three Word)

Keyword Occurrence Density Possible Spam
Octave financial package 6 0.30 % No
GNU Octave financial 6 0.30 % No
pricing a European 2 0.10 % No
SDE 1 DeltaTime 2 0.10 % No
T mean max 2 0.10 % No
r T mean 2 0.10 % No
exp r T 2 0.10 % No
= exp r 2 0.10 % No
1 DeltaTime T 2 0.10 % No
K Compare with 2 0.10 % No
the GNU Octave 2 0.10 % No
Timesteps Antithetic true 2 0.10 % No
NSTEPS Timesteps Antithetic 2 0.10 % No
Simulations NSTEPS Timesteps 2 0.10 % No
NTRIALS Simulations NSTEPS 2 0.10 % No
T NTRIALS Simulations 2 0.10 % No
DeltaTime T NTRIALS 2 0.10 % No
example pricing a 2 0.10 % No
SDE = gbm 2 0.10 % No
Compare with the 2 0.10 % No

SEO Keywords (Four Word)

Keyword Occurrence Density Possible Spam
GNU Octave financial package 5 0.25 % No
with the exact answer 2 0.10 % No
simulations in GNU Octave 2 0.10 % No
the GNU Octave financial 2 0.10 % No
NTRIALS Simulations NSTEPS Timesteps 2 0.10 % No
T NTRIALS Simulations NSTEPS 2 0.10 % No
DeltaTime T NTRIALS Simulations 2 0.10 % No
1 DeltaTime T NTRIALS 2 0.10 % No
= exp r T 2 0.10 % No
exp r T mean 2 0.10 % No
r T mean max 2 0.10 % No
SDE 1 DeltaTime T 2 0.10 % No
NSTEPS Timesteps Antithetic true 2 0.10 % No
in GNU Octave financial 2 0.10 % No
Carlo simulations in GNU 2 0.10 % No
Monte Carlo simulations in 2 0.10 % No
Timesteps = 10 SDE 2 0.10 % No
= 10 SDE = 2 0.10 % No
10 SDE = gbm 2 0.10 % No
Simulations NSTEPS Timesteps Antithetic 2 0.10 % No

Internal links in - parsiad.ca

Selected publications
Selected publications - Parsiad Azimzadeh
Blog
Parsiad Azimzadeh
read about the latest release here
GNU Octave financial 0.5.0 released - Parsiad Azimzadeh
Monte Carlo simulation framework
Monte Carlo simulations in GNU Octave financial package - Parsiad Azimzadeh
An introduction to regular Markov chains
An introduction to regular Markov chains - Parsiad Azimzadeh
mlinterp: Fast arbitrary dimension linear interpolation in C++
mlinterp: Fast arbitrary dimension linear interpolation in C++ - Parsiad Azimzadeh
Optimal stopping III: a comparison principle
Optimal stopping III: a comparison principle - Parsiad Azimzadeh
Optimal stopping II: a dynamic programming equation
Optimal stopping II: a dynamic programming equation - Parsiad Azimzadeh
Optimal stopping I: a dynamic programming principle
Optimal stopping I: a dynamic programming principle - Parsiad Azimzadeh
Introductory group theory
Introductory group theory - Parsiad Azimzadeh
Closed-form expressions for perpetual and finite-maturity American binary options
Closed-form expressions for perpetual and finite-maturity American binary options - Parsiad Azimzadeh
Fast Fourier Transform with examples in GNU Octave/MATLAB
Fast Fourier Transform with examples in GNU Octave/MATLAB - Parsiad Azimzadeh
Welcome
Welcome - Parsiad Azimzadeh
Markov chains (1)
Parsiad Azimzadeh
Optimal stopping (3)
Parsiad Azimzadeh
GNU Octave (2)
Parsiad Azimzadeh
Notes (2)
Parsiad Azimzadeh
Mathematical finance (1)
Parsiad Azimzadeh
RSS
Parsiad Azimzadeh

Parsiad.ca Spined HTML


Monte Carlo simulations in GNU Octave financial package - Parsiad Azimzadeh Parsiad Azimzadeh Selected publications Blog Menu Curriculum vitae Selected publications Blog Log in Monte Carlo simulations in GNU Octave financial package December 1, 2015 Parsiad Azimzadeh I have recently taken on the role of maintaining the GNU Octave financial package. I recently implemented stochastic differential equation simulation, which I discuss in this post. If you don't once have a reprinting of GNU Octave and the financial package, see this post for installation instructions. Consider the pursuit SDE: $$dX_t = F(t, X_t) dt + G(t, X_t) dW_t$$ where $W$ is a standard Brownian motion. With the Octave financial package, you can now simulate sample paths of this SDE. Let's take a moment to motivate why you might want to do this... A simple example: pricing a European undeniability A archetype problem in finance is that of pricing a European option, for which one needs to compute an expectation involving the random variable $X_T$ at some stock-still time $T>0$, referred to as the expiry time. For example, the Black-Scholes undeniability pricing problem is that of computing $$E\left[e^{-rT} (X_T-K)^+\right]$$ where $X$ follows a geometric Brownian motion (GBM): $$dX_t = (r-\delta) X_t dt + \sigma X_t dW_t.$$ Here, $r$ is the risk-free rate, $\delta$ is the dividend rate, and $\sigma$ is the volatility. Approximating such an expectation using a sample midpoint is referred to as Monte Carlo integration (a.k.a. Monte Carlo simulation). Though the Black-Scholes pricing problem happens to be one in which a closed-form solution is known, as an expository example, let's perform Monte Carlo integration to injudicious it using an SDE simulation: % Test parameters X_0 = 100.; K = 100.; r = 0.04; delta = 0.01; sigma = 0.2; T = 1.; Simulations = 1e6; Timesteps = 10; SDE = gbm (r - delta, sigma, "StartState", X_0); [Paths, ~, ~] = simByEuler (SDE, 1, "DeltaTime", T, "NTRIALS", Simulations, "NSTEPS", Timesteps, "Antithetic", true); % Monte Carlo price CallPrice_MC = exp (-r * T) * midpoint (max (Paths(end, 1, :) - K, 0.)); % Compare with the word-for-word wordplay (Black-Scholes formula): 9.3197 The gbm function is used to generate an object describing geometric Brownian motion (GBM). Under the hood, it invokes the sde constructor, which is capable of constructing more unstipulated SDEs. Timing The GNU Octave financial implementation uses dissemination to speed up computation. Here is a speed comparison of the whilom with the MATLAB Financial Toolbox, under a varying number of timesteps: Timesteps MATLAB Financial Toolbox (secs.) GNU Octave financial package (secs.) 16 0.543231 0.048691 32 1.053423 0.064110 64 2.167072 0.097092 128 4.191894 0.162552 256 8.361655 0.294098 512 16.609718 0.568558 1024 32.839757 1.136864 While both implementations scale more-or-less linearly, the GNU Octave financial package implementation profoundly outperforms its MATLAB counterpart. A multi-dimensional example: pricing a Basket undeniability Consider two assets, $X^1$ and $X^2$, and the basket undeniability option pricing problem $$E\left[e^{-rT}\left(\max\left(X^1_T,X^2_T\right)-K\right)^+\right]$$ where $$dX_t^i = (r-\delta^i) X^i_t dt + \sigma^i X^i_t dW^i_t \text{ for } i = 1,2$$ and the correlation between the Wiener processes is $dW^1_t dW^2_t = \rho dt$. Sample lawmaking for this example is below: % Test parameters X1_0 = 40.; X2_0 = 40.; K = 40.; r = 0.05; delta1 = 0.; delta2 = 0.; sigma1 = 0.5; sigma2 = 0.5; T = 0.25; rho = 0.3; Simulations = 1e5; Timesteps = 10; SDE = gbm ([r-delta1 0.; 0. r-delta2], [sigma1 0.; 0. sigma2], "StartState", [X1_0; X2_0], "Correlation", [1 rho; rho 1]); [Paths, ~, ~] = simulate (SDE, 1, "DeltaTime", T, "NTRIALS", Simulations, "NSTEPS", Timesteps, "Antithetic", true); Max_Xi_T = max (Paths(end, :, :)); BasketCallPrice_MC = exp (-r * T) * midpoint (max (Max_Xi_T - K, 0.)); % Compare with the word-for-word wordplay (Stulz 1982): 6.8477 GNU Octave Parsiad Azimzadeh AboutPhD (University of Waterloo), MMath (University of Waterloo), BSc (Simon Fraser University)Latest postsAn introduction to regular Markov chainsmlinterp: Fast wrong-headed dimension linear interpolation in C++Optimal stopping III: a comparison principleOptimal stopping II: a dynamic programming equationOptimal stopping I: a dynamic programming principleGNU Octave financial 0.5.0 releasedMonte Carlo simulations in GNU Octave financial packageIntroductory group theoryClosed-form expressions for perpetual and finite-maturity American binary optionsFast Fourier Transform with examples in GNU Octave/MATLABPagesHomeSelected publicationsWelcomeTagsMarkov villenage (1)Optimal stopping (3)GNU Octave (2)Notes (2)Mathematical finance (1) RSS | Design: HTML5 UP Please enable JavaScript to view the comments powered by Disqus.