Finance
ExpectedValue
compute the expected value
Calling Sequence
Parameters
Options
Description
Examples
References
Compatibility
ExpectedValue(pathfunction, pathgenerator, opts)
ExpectedValue(pathfunction, process, timegrid, opts)
ExpectedValue(pathfunction, process, timeinterval, opts)
ExpectedValue(expression, opts)
pathfunction
-
procedure; path function
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 replications, timesteps, or output; specify options for the ExpectedValue command
replications = posint -- This option specifies the number of replications of the sample path. By default, only one replication of the sample path is generated.
timesteps = posint -- This option specifies the number of time steps. This option is ignored if an explicit time grid is specified. By default, only one time step is used.
output = value, standarddeviation, skewness, kurtosis, minimum, maximum, standarderror, or a list containing several of these quantities -- This option specifies the quantities to be returned by the ExpectedValue command.
The ExpectedValue(pathfunction, pathgenerator, opts) calling sequence computes a Monte Carlo estimate of pathfunction using sample paths generated by pathgenerator. The procedure consists of the following steps:
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 pathfunction⁡A.
Repeat these two steps the specified number of times (see the replications option) and compute the mean average.
The ExpectedValue command also computes such statistics as standard deviation, skewness, kurtosis, minimum, maximum, and standard error (see the output option).
The ExpectedValue(pathfunction, process, timegrid, opts) and ExpectedValue(pathfunction, process, timeinterval, opts) calling sequences first construct the corresponding path generator and then perform the same computations as above.
The parameter timeinterval must be of type range T0..T1, where T0 and T1 are non-negative constants such that T0<T1.
When the ExpectedValue(pathfunction, process, timeinterval, opts) calling sequence is used, the uniform time grid between T0 and T1 (with time steps dt=T1−T0timesteps) 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 ExpectedValue(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, ExpectedValue 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 X⁡t, where t is some expression. If X is multi-dimensional stochastic, then the individual components of X can be accessed using the notation X⁡ti.
with⁡Finance:
Here is a simple one-dimensional stochastic process.
X≔WienerProcess⁡
X≔_W
ExpectedValue⁡exp⁡X⁡3,timesteps=100,replications=104
value=4.415830322,standarderror=0.1470262675
Use a Maple procedure to compute the same expression.
T≔TimeGrid⁡3,100:
GX≔PathGenerator⁡X,T:
ExpectedValue⁡A↦exp⁡A101,GX,replications=104
value=4.332990756,standarderror=0.1823894082
Here is an example involving a multivariate stochastic process.
Σ≔1.0,0.5|0.5,1.0
Σ≔1.00.50.51.0
W≔WienerProcess⁡Σ
W≔_W0
ExpectedValue⁡max⁡W⁡31,W⁡31,timesteps=100,replications=104
value=0.01066470082,standarderror=0.01729081520
Here is the same computation using Maple procedures.
GW≔PathGenerator⁡W,T:
ExpectedValue⁡A↦max⁡A1101,A2101,GW,replications=104
value=0.6923222938,standarderror=0.01590458352
ExpectedValue⁡A↦max⁡A1101,A2101,GW,replications=104,output=value,kurtosis,standarddeviation
value=0.7136688774,kurtosis=0.06544236356,standarddeviation=1.577664771
ExpectedValue⁡A↦max⁡A1101,A2101,GW,replications=104,output=all
value=0.6625887538,standarderror=0.01590665822,standarddeviation=1.590665822,skewness=0.04340299702,kurtosis=0.07854336158,minimum=−5.084725783,maximum=7.045870381,standarderror=0.01590665822
Use a two-dimensional Ito process using two one-dimensional projections and a given covariance matrix.
X≔GeometricBrownianMotion⁡100.0,0.05,0.3,t
X≔_X2
Y≔GeometricBrownianMotion⁡100.0,0.07,0.2,t
Y≔_X3
Σ≔1|0.5,0.5|1
Σ≔10.50.51
Z≔ItoProcess⁡X,Y,Σ
Z≔_X4
Drift⁡Z⁡t
0.05⁢_X4⁡t10.07⁢_X4⁡t2
Diffusion⁡Z⁡t
0.3⁢_X4⁡t10.15⁢_X4⁡t10.10⁢_X4⁡t20.2⁢_X4⁡t2
ExpectedValue⁡max⁡X⁡1−Y⁡1,0,timesteps=100,replications=104
value=14.51713768,standarderror=0.2410592509
ExpectedValue⁡max⁡Z⁡11−Z⁡12,0,timesteps=100,replications=104
value=8.016115759,standarderror=0.1486964255
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.
The Finance[ExpectedValue] command was introduced in Maple 15.
For more information on Maple 15 changes, see Updates in Maple 15.
See Also
Finance[BrownianMotion]
Finance[CEVProcess]
Finance[DeterministicProcess]
Finance[Diffusion]
Finance[Drift]
Finance[GaussianShortRateProcess]
Finance[GeometricBrownianMotion]
Finance[HestonProcess]
Finance[OrnsteinUhlenbeckProcess]
Finance[PathPlot]
Finance[SamplePath]
Finance[SampleValues]
Finance[SquareRootDiffusion]
Finance[StochasticProcesses]
Finance[ValueAtRisk]
Finance[WienerProcess]
Download Help Document