calculate value-at-risk - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Mathematics : Finance : Stochastic Processes : Finance/ValueAtRisk

Finance[ValueAtRisk] - calculate value-at-risk

Calling Sequence

ValueAtRisk(pathfunction, pathgenerator, opts)

ValueAtRisk(pathfunction, process, timegrid, opts)

ValueAtRisk(pathfunction, process, timeinterval, opts)

ValueAtRisk(expression, opts)

Parameters

pathfunction

-

procedure; path function (see description)

pathgenerator

-

path generator data structure; path generator

process

-

one- or multi-dimensional stochastic process, or list or vector of one-dimensional stochastic processes

timegrid

-

range or time grid data structure; time grid

timeinterval

-

range; time interval

expression

-

algebraic expression; expression whose value is to be estimated

opts

-

(optional) equation(s) of the form option = value where option is one of confidencelevel, replications, or timesteps; specify options for the ValueAtRisk command

Description

• 

The ValueAtRisk(pathfunction, pathgenerator, opts) calling sequence computes a Monte Carlo estimate of the value-at-risk of a portfolio whose total value is governed by the specified stochastic process. It follows the same procedure as the SamplePath and ExpectedValue commands:

– 

Generate a replication of the sample path using the specified path generator and store these values as a Maple Array, for example A. In the case of a one-dimensional process, A is a one-dimensional array of size n, where n is the number of points in the time grid (the number of time steps plus one). In the case of a multi-dimensional process, A is a two-dimensional array of size m,n, where m is the dimension of the underlying stochastic process and n is the same as in the one-dimensional case.

– 

Compute the value pathfunctionA.

– 

Repeat these two steps the specified number of times (see the replications option) and compute the mean average.

• 

The ValueAtRisk(pathfunction, process, timegrid, opts) and ValueAtRisk(pathfunction, process, timeinterval, opts) calling sequences first construct the corresponding path generator and then perform the same computations as above.

• 

The parameter pathfunction must be a Maple procedure that accepts a one-dimensional array of floating-point numbers (sample path for the underlying process) and returns the corresponding value as a floating point number. A path function can be used for example to compute expected values for some path-dependent payoffs.

• 

The timegrid parameter can be used to pass non-homogeneous time grids to the simulation routines. It must be given as a data structure generated by the TimeGrid command.

• 

The timeinterval parameter must be of type range T0..T1, where T0 and T1 are non-negative constants such that T0<T1. When the ValueAtRisk(pathfunction, process, timeinterval, opts) calling sequence is used, the uniform time grid between T0 and T1 (with time steps dt&equals;T1T0timesteps) is generated.

  

Note that if 0<T0, the value at T0 will be simulated using a single step of the default discretization method and hence can suffer from a significant discretization bias. Increasing the number of time steps will refine the grid between T0 and T1, but will have no effect on the value at T0. To reduce the bias, use a time interval of the form 0..T1.

• 

The ValueAtRisk(expression, opts) calling sequence attempts to extract all the stochastic variables involved in expression and generate the corresponding path generator and path function using the specified number of time steps. In particular, ValueAtRisk will extract all time instances involved in expression and adjust them so that they belong to the grid.

  

All stochastic variables involved in expression should be of the form Xt, where t is some expression. If X is multi-dimensional stochastic, then the individual components of X can be accessed using the notation Xti.

Examples

withFinance&colon;

Consider a simple one-dimensional stochastic process.

X:=WienerProcess

X:=_W

(1)

ValueAtRisk&ExponentialE;X30.3&comma;timesteps&equals;100&comma;replications&equals;104

0.0134877625003790

(2)

Use a Maple procedure to compute the same expression.

T:=TimeGrid3&comma;100&colon;

GX:=PathGeneratorX&comma;T&colon;

ValueAtRiskA&rarr;&ExponentialE;A101&comma;GX&comma;replications&equals;104

0.0182596710266536

(3)

Here is an example involving multivariate stochastic process.

&Sigma;:=1.0&comma;0.5&verbar;0.5&comma;1.0

&Sigma;:=1.00.50.51.0

(4)

W:=WienerProcess&Sigma;

W:=_W0

(5)

ValueAtRiskmaxW31&comma;W31&comma;timesteps&equals;100&comma;replications&equals;104

4.03428784667168

(6)

This is the same computation but using Maple procedures.

T:=TimeGrid3&comma;100&colon;

GW:=PathGeneratorW&comma;T&colon;

ValueAtRiskA&rarr;maxA1101&comma;A2101&comma;GW&comma;replications&equals;104

2.94525443555014

(7)

ValueAtRiskA&rarr;maxA1101&comma;A2101&comma;GW&comma;replications&equals;104

2.97502928649521

(8)

ValueAtRiskA&rarr;maxA1101&comma;A2101&comma;GW&comma;replications&equals;104

3.07016193438461

(9)

Use a two-dimensional Ito process with two one-dimensional projections and a given covariance matrix.

X:=GeometricBrownianMotion100.0&comma;0.05&comma;0.3&comma;t

X:=_X1

(10)

Y:=GeometricBrownianMotion100.0&comma;0.07&comma;0.2&comma;t

Y:=_X2

(11)

&Sigma;:=1&verbar;0.5&comma;0.5&verbar;1

&Sigma;:=10.50.51

(12)

Z:=ItoProcessX&comma;Y&comma;&Sigma;

Z:=_X3

(13)

DriftZt

0.05_X3t10.07_X3t2

(14)

DiffusionZt

0.3_X3t10.15_X3t10.10_X3t20.2_X3t2

(15)

ValueAtRiskX1Y1&comma;timesteps&equals;100&comma;replications&equals;104

83.1589172222060

(16)

ValueAtRiskZ11Z12&comma;timesteps&equals;100&comma;replications&equals;104

44.0547261307466

(17)

See Also

Finance[BrownianMotion], Finance[CEVProcess], Finance[DeterministicProcess], Finance[Diffusion], Finance[Drift], Finance[ExpectedShortfall], Finance[GaussianShortRateProcess], Finance[GeometricBrownianMotion], Finance[HestonProcess], Finance[OrnsteinUhlenbeckProcess], Finance[PathPlot], Finance[SamplePath], Finance[SampleValues], Finance[SquareRootDiffusion], Finance[StochasticProcesses], Finance[WienerProcess]

References

  

Glasserman, P., Monte Carlo Methods in Financial Engineering. New York: Springer-Verlag, 2004.

  

Hull, J., Options, Futures, and Other Derivatives, 5th. edition. Upper Saddle River, New Jersey: Prentice Hall, 2003.

  

Kloeden, P., and Platen, E., Numerical Solution of Stochastic Differential Equations, New York: Springer-Verlag, 1999.


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam