SSJ API Documentation
Stochastic Simulation in Java
Loading...
Searching...
No Matches
umontreal.ssj.stochprocess.BrownianMotion Class Reference

This class represents a Brownian motion process \(\{X(t) : t \geq0 \}\), sampled at times \(0 = t_0 < t_1 < \cdots< t_d\). More...

Inheritance diagram for umontreal.ssj.stochprocess.BrownianMotion:
umontreal.ssj.stochprocess.StochasticProcess umontreal.ssj.stochprocess.BrownianMotionBridge umontreal.ssj.stochprocess.BrownianMotionPCA umontreal.ssj.stochprocess.BrownianMotionPCAEqualSteps

Public Member Functions

 BrownianMotion (double x0, double mu, double sigma, RandomStream stream)
 Constructs a new BrownianMotion with parameters \(\mu=\) mu,.
 BrownianMotion (double x0, double mu, double sigma, NormalGen gen)
 Constructs a new BrownianMotion with parameters \(\mu=\) mu,.
double nextObservation ()
 Generates and returns the next observation \(X(t_j)\) of the stochastic process.
double nextObservation (double nextTime)
 Generates and returns the next observation at time \(t_{j+1} =\) nextTime.
double nextObservation (double x, double dt)
 Generates an observation of the process in dt time units, assuming that the process has value \(x\) at the current time.
double[] generatePath ()
 Generates, returns, and saves the sample path \(\{X(t_0), X(t_1), \dots, X(t_d)\}\).
double[] generatePath (double[] uniform01)
 Same as generatePath(), but a vector of uniform random numbers must be provided to the method.
double[] generatePath (RandomStream stream)
 Same as generatePath(), but first resets the stream to stream.
void setParams (double x0, double mu, double sigma)
 Resets the parameters \(X(t_0) = \mathtt{x0}\), \(\mu= \mathtt{mu}\) and \(\sigma= \mathtt{sigma}\) of the process.
void setStream (RandomStream stream)
 Resets the random stream of the normal generator to stream.
RandomStream getStream ()
 Returns the random stream of the normal generator.
double getMu ()
 Returns the value of \(\mu\).
double getSigma ()
 Returns the value of \(\sigma\).
NormalGen getGen ()
 Returns the normal random variate generator used.
Public Member Functions inherited from umontreal.ssj.stochprocess.StochasticProcess
void setObservationTimes (double[] T, int d)
 Sets the observation times of the process to a copy of T, with.
void setObservationTimes (double delta, int d)
 Sets equidistant observation times at \(t_j = j\delta\), for.
double[] getObservationTimes ()
 Returns a reference to the array that contains the observation times.
int getNumObservationTimes ()
 Returns the number \(d\) of observation times, excluding the time \(t_0\).
double[] getPath ()
 Returns a reference to the last generated sample path \(\{X(t_0), ... , X(t_d)\}\).
void getSubpath (double[] subpath, int[] pathIndices)
 Returns in subpath the values of the process at a subset of the observation times, specified as the times \(t_j\) whose indices.
double getObservation (int j)
 Returns \(X(t_j)\) from the current sample path.
void resetStartProcess ()
 Resets the observation counter to its initial value \(j=0\), so that the current observation \(X(t_j)\) becomes \(X(t_0)\).
boolean hasNextObservation ()
 Returns true if \(j<d\), where \(j\) is the number of observations of the current sample path generated since the last call to resetStartProcess.
int getCurrentObservationIndex ()
 Returns the value of the index \(j\) corresponding to the time.
double getCurrentObservation ()
 Returns the value of the last generated observation \(X(t_j)\).
double getX0 ()
 Returns the initial value \(X(t_0)\) for this process.
void setX0 (double s0)
 Sets the initial value \(X(t_0)\) for this process to s0, and reinitializes.
int[] getArrayMappingCounterToIndex ()
 Returns a reference to an array that maps an integer \(k\) to \(i_k\), the index of the observation \(S(t_{i_k})\) corresponding to the.

Detailed Description

This class represents a Brownian motion process \(\{X(t) : t \geq0 \}\), sampled at times \(0 = t_0 < t_1 < \cdots< t_d\).

This process obeys the stochastic differential equation

\[ dX(t) = \mu dt + \sigma dB(t), \tag{Brownian-motion} \]

with initial condition \(X(0)= x_0\), where \(\mu\) and \(\sigma\) are the drift and volatility parameters, and \(\{B(t),  t\ge0\}\) is a standard Brownian motion (with drift 0 and volatility 1). This process has stationary and independent increments over disjoint time intervals (it is a Lévy process) and the increment over an interval of length \(t\) is normally distributed with mean \(\mu t\) and variance \(\sigma^2 t\).

In this class, this process is generated using the sequential (or random walk) technique: \(X(0)=x_0\) and

\[ X(t_j) - X(t_{j-1}) = \mu(t_j - t_{j-1}) + \sigma\sqrt{t_j - t_{j-1}} Z_j \tag{Brownian-motion-sequential} \]

where \(Z_j \sim N(0,1)\).

Definition at line 54 of file BrownianMotion.java.

Constructor & Destructor Documentation

◆ BrownianMotion() [1/2]

umontreal.ssj.stochprocess.BrownianMotion.BrownianMotion ( double x0,
double mu,
double sigma,
RandomStream stream )

Constructs a new BrownianMotion with parameters \(\mu=\) mu,.

\(\sigma=\) sigma and initial value \(X(t_0) =\) x0. The normal variates \(Z_j\) in ( Brownian-motion-sequential ) will be generated by inversion using stream.

Definition at line 69 of file BrownianMotion.java.

◆ BrownianMotion() [2/2]

umontreal.ssj.stochprocess.BrownianMotion.BrownianMotion ( double x0,
double mu,
double sigma,
NormalGen gen )

Constructs a new BrownianMotion with parameters \(\mu=\) mu,.

\(\sigma=\) sigma and initial value \(X(t_0) =\) x0. Here, the normal variate generator umontreal.ssj.randvar.NormalGen is specified directly instead of specifying the stream and using inversion. The normal generator gen can use another method than inversion.

Definition at line 82 of file BrownianMotion.java.

Member Function Documentation

◆ generatePath() [1/3]

double[] umontreal.ssj.stochprocess.BrownianMotion.generatePath ( )

Generates, returns, and saves the sample path \(\{X(t_0), X(t_1), \dots, X(t_d)\}\).

It can then be accessed via getPath, getSubpath, or getObservation. The generation method depends on the process type.

Reimplemented from umontreal.ssj.stochprocess.StochasticProcess.

Reimplemented in umontreal.ssj.stochprocess.BrownianMotionBridge, umontreal.ssj.stochprocess.BrownianMotionPCA, and umontreal.ssj.stochprocess.BrownianMotionPCAEqualSteps.

Definition at line 128 of file BrownianMotion.java.

◆ generatePath() [2/3]

double[] umontreal.ssj.stochprocess.BrownianMotion.generatePath ( double[] uniform01)

Same as generatePath(), but a vector of uniform random numbers must be provided to the method.

These uniform random numbers are used to generate the path.

Reimplemented in umontreal.ssj.stochprocess.BrownianMotionBridge, umontreal.ssj.stochprocess.BrownianMotionPCA, and umontreal.ssj.stochprocess.BrownianMotionPCAEqualSteps.

Definition at line 144 of file BrownianMotion.java.

◆ generatePath() [3/3]

double[] umontreal.ssj.stochprocess.BrownianMotion.generatePath ( RandomStream stream)

Same as generatePath(), but first resets the stream to stream.

Reimplemented from umontreal.ssj.stochprocess.StochasticProcess.

Definition at line 155 of file BrownianMotion.java.

◆ getGen()

NormalGen umontreal.ssj.stochprocess.BrownianMotion.getGen ( )

Returns the normal random variate generator used.

The

umontreal.ssj.rng.RandomStream used by that generator can be changed via getGen().setStream(stream), for example.

Definition at line 210 of file BrownianMotion.java.

◆ getMu()

double umontreal.ssj.stochprocess.BrownianMotion.getMu ( )

Returns the value of \(\mu\).

Definition at line 193 of file BrownianMotion.java.

◆ getSigma()

double umontreal.ssj.stochprocess.BrownianMotion.getSigma ( )

Returns the value of \(\sigma\).

Definition at line 200 of file BrownianMotion.java.

◆ getStream()

RandomStream umontreal.ssj.stochprocess.BrownianMotion.getStream ( )

Returns the random stream of the normal generator.

Reimplemented from umontreal.ssj.stochprocess.StochasticProcess.

Definition at line 186 of file BrownianMotion.java.

◆ nextObservation() [1/3]

double umontreal.ssj.stochprocess.BrownianMotion.nextObservation ( )

Generates and returns the next observation \(X(t_j)\) of the stochastic process.

The processes are usually sampled sequentially, i.e. if the last observation generated was for time

\(t_{j-1}\), the next observation returned will be for time \(t_j\). In some cases, subclasses extending this abstract class may use non-sequential sampling algorithms (such as bridge sampling). The order of generation of the \(t_j\)’s is then specified by the subclass. All the processes generated using principal components analysis (PCA) do not have this method.

Reimplemented from umontreal.ssj.stochprocess.StochasticProcess.

Reimplemented in umontreal.ssj.stochprocess.BrownianMotionBridge, umontreal.ssj.stochprocess.BrownianMotionPCA, and umontreal.ssj.stochprocess.BrownianMotionPCAEqualSteps.

Definition at line 89 of file BrownianMotion.java.

◆ nextObservation() [2/3]

double umontreal.ssj.stochprocess.BrownianMotion.nextObservation ( double nextTime)

Generates and returns the next observation at time \(t_{j+1} =\) nextTime.

It uses the previous observation time \(t_j\) defined earlier (either by this method or by setObservationTimes), as well as the value of the previous observation \(X(t_j)\). Warning: This method will reset the observations time \(t_{j+1}\) for this process to nextTime. The user must make sure that the \(t_{j+1}\) supplied is \(\geq t_j\).

Reimplemented in umontreal.ssj.stochprocess.BrownianMotionBridge.

Definition at line 105 of file BrownianMotion.java.

◆ nextObservation() [3/3]

double umontreal.ssj.stochprocess.BrownianMotion.nextObservation ( double x,
double dt )

Generates an observation of the process in dt time units, assuming that the process has 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).

Definition at line 123 of file BrownianMotion.java.

◆ setParams()

void umontreal.ssj.stochprocess.BrownianMotion.setParams ( double x0,
double mu,
double sigma )

Resets the parameters \(X(t_0) = \mathtt{x0}\), \(\mu= \mathtt{mu}\) and \(\sigma= \mathtt{sigma}\) of the process.

Warning: This method will recompute some quantities stored internally, which may be slow if called too frequently.

Reimplemented in umontreal.ssj.stochprocess.BrownianMotionPCA.

Definition at line 166 of file BrownianMotion.java.

◆ setStream()

void umontreal.ssj.stochprocess.BrownianMotion.setStream ( RandomStream stream)

Resets the random stream of the normal generator to stream.

Reimplemented from umontreal.ssj.stochprocess.StochasticProcess.

Definition at line 179 of file BrownianMotion.java.


The documentation for this class was generated from the following file: