SSJ
V. labo.

umontreal.iro.lecuyer.stochprocess
Class MultivariateBrownianMotion

java.lang.Object
  extended by umontreal.iro.lecuyer.stochprocess.StochasticProcess
      extended by umontreal.iro.lecuyer.stochprocess.MultivariateStochasticProcess
          extended by umontreal.iro.lecuyer.stochprocess.MultivariateBrownianMotion
Direct Known Subclasses:
MultivariateBrownianMotionBridge, MultivariateBrownianMotionPCA, MultivariateBrownianMotionPCABigSigma

public class MultivariateBrownianMotion
extends MultivariateStochasticProcess

This class represents a multivariate Brownian motion process {X(t) = (X1(t),..., Xc(t)), t >= 0}, sampled at times 0 = t0 < t1 < ... < td. Each vector coordinate is a univariate Brownian motion {Xi(t), t >= 0}, with drift and volatility parameters μi and σi, so it can be written as

Xi(tj) - Xi(tj-1) = (tj - tj-1)μi + (t_j - t_j-1)1/2σiZj, i

where Xi(0) = 0, each Zj, iN(0, 1), and each Zj = (Zj, 1,..., Zj, c) has correlation matrix Rz. We write μ = (μ1,..., μc)t, σ = (σ1,..., σc)t, and Σ for the covariance matrix of X(1) - X(0), which equals Σ = σRzσt (so the element (k, l ) or Σ is the element (k, l ) of Rz multiplied by σkσl). The trajectories are sampled by the sequential (or random walk) method.


Constructor Summary
MultivariateBrownianMotion(int c, double[] x0, double[] mu, double[] sigma, double[][] corrZ, NormalGen gen)
          Constructs a new MultivariateBrownianMotion with parameters μ = mu, σ = sigma, correlation matrix Rz = corrZ, and initial value X(t0) = x0.
MultivariateBrownianMotion(int c, double[] x0, double[] mu, double[] sigma, double[][] corrZ, RandomStream stream)
          Constructs a new MultivariateBrownianMotion with parameters μ = mu, σ = sigma, correlation matrix Rz = corrZ, and initial value X(t0) = x0.
 
Method Summary
 double[] generatePath()
          Generates, returns, and saves the sample path {X(t0),X(t1),…,X(td)}, which can then be accessed via getPath, getSubpath, or getObservation.
 double[] generatePath(double[] uniform01)
          Same as generatePath() but requires a vector of uniform random numbers which are used to generate the path.
 double[] generatePath(RandomStream stream)
          Same as generatePath(), but first resets the stream to stream.
 NormalGen getGen()
          Returns the normal random variate generator used.
 double[] getMu()
          Returns the vector mu.
 RandomStream getStream()
          Returns the random stream of the normal generator.
 double[] nextObservationVector()
          Generates and returns the next observation X(tj) of the multivariate stochastic process in a vector created automatically.
 void nextObservationVector(double[] obs)
          Generates and returns in obs the next observation X(tj) of the multivariate stochastic process.
 double[] nextObservationVector(double[] x, double dt)
          Generates an observation (vector) of the process in dt time units, assuming that the process has (vector) value x at the current time.
 double[] nextObservationVector(double nextTime, double[] obs)
          Generates and returns the vector of next observations, at time tj+1 = nextTime, using the previous observation time tj defined earlier (either by this method or by setObservationTimes), as well as the value of the previous observation X(tj).
 void setParams(double[] x0, double[] mu, double[] sigma)
          Sets the dimension c = c, the initial value X(t0) = x0, the average μ = mu, the volatility σ = sigma.
 void setParams(int c, double[] x0, double[] mu, double[] sigma, double[][] corrZ)
          Sets the dimension c = c, the initial value X(t0) = x0, the average μ = mu, the volatility σ = sigma and the correlation matrix to corrZ.
 void setStream(RandomStream stream)
          Resets the random stream of the normal generator to stream.
 
Methods inherited from class umontreal.iro.lecuyer.stochprocess.MultivariateStochasticProcess
getCurrentObservation, getDimension, getObservation, getObservation, getSubpath, getX0, setObservationTimes
 
Methods inherited from class umontreal.iro.lecuyer.stochprocess.StochasticProcess
getArrayMappingCounterToIndex, getCurrentObservation, getCurrentObservationIndex, getNbObservationTimes, getObservation, getObservationTimes, getPath, getX0, hasNextObservation, nextObservation, resetStartProcess, setObservationTimes, setX0
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultivariateBrownianMotion

public MultivariateBrownianMotion(int c,
                                  double[] x0,
                                  double[] mu,
                                  double[] sigma,
                                  double[][] corrZ,
                                  RandomStream stream)
Constructs a new MultivariateBrownianMotion with parameters μ = mu, σ = sigma, correlation matrix Rz = corrZ, and initial value X(t0) = x0. The normal variates Zj in are generated by inversion using the RandomStream stream.


MultivariateBrownianMotion

public MultivariateBrownianMotion(int c,
                                  double[] x0,
                                  double[] mu,
                                  double[] sigma,
                                  double[][] corrZ,
                                  NormalGen gen)
Constructs a new MultivariateBrownianMotion with parameters μ = mu, σ = sigma, correlation matrix Rz = corrZ, and initial value X(t0) = x0. The normal variates Zj in are generated by gen.

Method Detail

nextObservationVector

public void nextObservationVector(double[] obs)
Generates and returns in obs the next observation X(tj) of the multivariate stochastic process. The processe is sampled sequentially, i.e. if the last observation generated was for time tj-1, the next observation returned will be for time tj.

Specified by:
nextObservationVector in class MultivariateStochasticProcess

nextObservationVector

public double[] nextObservationVector()
Generates and returns the next observation X(tj) of the multivariate stochastic process in a vector created automatically. The processe is sampled sequentially, i.e. if the last observation generated was for time tj-1, the next observation returned will be for time tj.


nextObservationVector

public double[] nextObservationVector(double nextTime,
                                      double[] obs)
Generates and returns the vector of next observations, at time tj+1 = nextTime, using the previous observation time tj defined earlier (either by this method or by setObservationTimes), as well as the value of the previous observation X(tj). Warning : This method will reset the observations time tj+1 for this process to nextTime. The user must make sure that the tj+1 supplied is  >= tj.


nextObservationVector

public double[] nextObservationVector(double[] x,
                                      double dt)
Generates an observation (vector) of the process in dt time units, assuming that the process has (vector) value x at the current time. Uses the process parameters specified in the constructor. Note that this method does not affect the sample path of the process stored internally (if any).


generatePath

public double[] generatePath()
Description copied from class: MultivariateStochasticProcess
Generates, returns, and saves the sample path {X(t0),X(t1),…,X(td)}, which can then be accessed via getPath, getSubpath, or getObservation. The generation method depends on the process type. If path[] denotes the returned array, then path[cj + i-1] contains Xi(tj) for j = 0,..., d and i = 1,..., c.

Specified by:
generatePath in class MultivariateStochasticProcess

generatePath

public double[] generatePath(double[] uniform01)
Same as generatePath() but requires a vector of uniform random numbers which are used to generate the path.


generatePath

public double[] generatePath(RandomStream stream)
Description copied from class: StochasticProcess
Same as generatePath(), but first resets the stream to stream.

Overrides:
generatePath in class StochasticProcess

setParams

public void setParams(int c,
                      double[] x0,
                      double[] mu,
                      double[] sigma,
                      double[][] corrZ)
Sets the dimension c = c, the initial value X(t0) = x0, the average μ = mu, the volatility σ = sigma and the correlation matrix to corrZ. The vectors x0, mu ans sigma must be of size c as well as the matrix corrZ must be of size c x c. Warning: This method will recompute some quantities stored internally, which may be slow if called too frequently.


setParams

public void setParams(double[] x0,
                      double[] mu,
                      double[] sigma)
Sets the dimension c = c, the initial value X(t0) = x0, the average μ = mu, the volatility σ = sigma. Warning: This method will recompute some quantities stored internally, which may be slow if called too frequently.


setStream

public void setStream(RandomStream stream)
Resets the random stream of the normal generator to stream.

Specified by:
setStream in class StochasticProcess

getStream

public RandomStream getStream()
Returns the random stream of the normal generator.

Specified by:
getStream in class StochasticProcess

getGen

public NormalGen getGen()
Returns the normal random variate generator used. The RandomStream used for that generator can be changed via getGen().setStream(stream), for example.


getMu

public double[] getMu()
Returns the vector mu.


SSJ
V. labo.

To submit a bug or ask questions, send an e-mail to Pierre L'Ecuyer.