Finance Package Commands For Stochastic Processes
The Financial Modeling package supports a wide range of stochastic processes used in Financial Engineering. This includes processes for modeling equity prices, mean-reverting processes, pure jump processes, jump diffusions as well as multi-variate Ito processes. In addition, the package provides tools for building more complicated processes from simple ones. Below is the list of supported processes:
uni- or multi-variate Brownian motion
constant elasticity of variance (CEV) process
deterministic time-dependent process
a portfolio of stochastic processes that can be dynamically rebalanced
a finite state Markov chain
Gaussian process for modeling short-term interest rate introduced by Hull and White
geometric Brownian motion
stochastic volatility process introduced by Heston
general uni- or multi-variate Ito process defined by drift and diffusion
jump-diffusion process introduced by Merton
stochastic process with multiple regimes
Poisson process including the doubly-stochastic Poisson (Cox) process
stochastic volatility with jumps (SVJJ) process
uni- and multi-variate Wiener process including subordinated Wiener process
Here are some related commands.
compute a Monte Carlo estimate of the specified expression
compute the drift component of an Ito process
compute the diffusion component of an Ito process
plot sample path(s) of the specified stochastic process
generate a sample path for the specified stochastic process
generate sample values for the specified expression involving stochastic variables
estimate value-at-risk for the specified expression
For the first example consider the standard Wiener process.
The previous command created a new Maple variable representing the standard Wiener process. This is an ordinary Maple variable with additional attributes containing some information about the underlying stochastic process. This variable is typically accessed in the form Wt, where t is the time of interest. For example, the following command can be used to generate some replications of the sample path for the underlying stochastic process.
PathPlot⁡S,timegrid = 0..3,color = red..blue, thickness=3, axes = BOXED, tickmarks = 10, 10, gridlines
You can now generate a larger sample and use tools from the Statistics package to analyze the generated data.
0.6983974595 ≈ 0.7071067812
0.8626421722 ≈ 0.8660254038
You can also simulate any expression involving our stochastic variable.
ExpectedValue⁡expW3,timesteps = 100, replications=104
Simple expressions involving multiple stochastic parameters can be handled the same way.
W1 ≔ WienerProcess:
Alternatively, you can implement any kind of path function using Maple procedures. This function will be called on every replication of the sample path. In the case of a single stochastic factor the path function will be passed a one-dimensional array containing the sample path. In the case of multiple stochastic factors, the path function will be passed a two-dimensional array where each row contains a sample path for the corresponding stochastic factor.
Consider, for example, a path function that returns W13. In the case when the path function is given explicitly, you must know the number of time steps in advance. You will use 100 time steps in this example, which means that the sample path will contain 101 points.
Now you can compute the expected value of this path function.
Compare this to:
Consider an example involving two stochastic factors (the same as above).
Here is a procedure that computes the expected value of the absorbing Wiener process.
PathFunction:=procAlocali;forifrom2to11doifAi<=Float⁡0,0thenreturnFloat⁡0,0elifFloat⁡10,−1<=AithenreturnFloat⁡10,−1end ifend do;returnA11end proc:
An Ito process is a stochastic process Xt governed by the stochastic differential equation (SDE)
dXt = μXt, t⋅dt+σXt, t⋅dWt,
where μXt, t is the drift parameter and σXt, t is the volatility parameter. The coefficients of the above SDE can be extracted using the Drift and Diffusion commands.
Here is a slightly more complicated example.
Here is an example involving a multi-dimensional process.
Σ ≔ 1.0, 0.5|0.5, 1.0;
Here is an Ito process defined explicitly.
Term Structures worksheet, Cash Flow Analysis worksheet, Day Counters worksheet, Lattice Methods worksheet, Calendars worksheet
Download Help Document
What kind of issue would you like to report? (Optional)