umontreal.iro.lecuyer.stochprocess
Class BrownianMotion
- java.lang.Object
-
- umontreal.iro.lecuyer.stochprocess.StochasticProcess
-
- umontreal.iro.lecuyer.stochprocess.BrownianMotion
-
- Direct Known Subclasses:
- BrownianMotionBridge, BrownianMotionPCA, BrownianMotionPCAEqualSteps
public class BrownianMotion extends StochasticProcess
This class represents a Brownian motion process {X(t) : t >= 0}, sampled at times 0 = t0 < t1 < ... < td. This process obeys the stochastic differential equation with initial condition X(0) = x0, where μ and σ are the drift and volatility parameters, and {B(t), t >= 0} 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 μt and variance σ2t.In this class, this process is generated using the sequential (or random walk) technique: X(0) = x0 and
where Zj∼N(0, 1).
-
-
Constructor Summary
Constructors Constructor and Description BrownianMotion(double x0, double mu, double sigma, NormalGen gen)Constructs a new BrownianMotion with parameters μ = mu, σ = sigma and initial value X(t0) = x0.BrownianMotion(double x0, double mu, double sigma, RandomStream stream)Constructs a new BrownianMotion with parameters μ = mu, σ = sigma and initial value X(t0) = x0.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description double[]generatePath()Generates, returns, and saves the sample path {X(t0), X(t1),…, X(td)}.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.NormalGengetGen()Returns the normal random variate generator used.doublegetMu()Returns the value of μ.doublegetSigma()Returns the value of σ.RandomStreamgetStream()Returns the random stream of the normal generator.doublenextObservation()Generates and returns the next observation X(tj) of the stochastic process.doublenextObservation(double nextTime)Generates and returns the next observation at time tj+1 = nextTime.doublenextObservation(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.voidsetParams(double x0, double mu, double sigma)Resets the parameters X(t0) =x0 , μ =mu and σ =sigma of the process.voidsetStream(RandomStream stream)Resets the random stream of the normal generator to stream.-
Methods inherited from class umontreal.iro.lecuyer.stochprocess.StochasticProcess
getArrayMappingCounterToIndex, getCurrentObservation, getCurrentObservationIndex, getNbObservationTimes, getObservation, getObservationTimes, getPath, getSubpath, getX0, hasNextObservation, resetStartProcess, setObservationTimes, setObservationTimes, setX0
-
-
-
-
Constructor Detail
-
BrownianMotion
public BrownianMotion(double x0, double mu, double sigma, RandomStream stream)Constructs a new BrownianMotion with parameters μ = mu, σ = sigma and initial value X(t0) = x0. The normal variates Zj in will be generated by inversion using stream.
-
BrownianMotion
public BrownianMotion(double x0, double mu, double sigma, NormalGen gen)Constructs a new BrownianMotion with parameters μ = mu, σ = sigma and initial value X(t0) = x0. Here, the normal variate generatorNormalGenis specified directly instead of specifying the stream and using inversion. The normal generator gen can use another method than inversion.
-
-
Method Detail
-
nextObservation
public double nextObservation()
Description copied from class:StochasticProcessGenerates and returns the next observation X(tj) of the stochastic process. The processes are usually sampled sequentially, i.e. if the last observation generated was for time tj-1, the next observation returned will be for time tj. In some cases, subclasses extending this abstract class may use non-sequential sampling algorithms (such as bridge sampling). The order of generation of the tj's is then specified by the subclass. All the processes generated using principal components analysis (PCA) do not have this method.- Overrides:
nextObservationin classStochasticProcess
-
nextObservation
public double nextObservation(double nextTime)
Generates and returns the next observation at time tj+1 = nextTime. It uses 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.
-
nextObservation
public 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. 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:StochasticProcessGenerates, returns, and saves the sample path {X(t0), X(t1),…, X(td)}. It can then be accessed via getPath, getSubpath, or getObservation. The generation method depends on the process type.- Specified by:
generatePathin classStochasticProcess
-
generatePath
public double[] 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.
-
generatePath
public double[] generatePath(RandomStream stream)
Description copied from class:StochasticProcessSame as generatePath(), but first resets the stream to stream.- Overrides:
generatePathin classStochasticProcess
-
setParams
public void setParams(double x0, double mu, double sigma)Resets the parameters X(t0) =x0 , μ =mu and σ =sigma of the process. 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:
setStreamin classStochasticProcess
-
getStream
public RandomStream getStream()
Returns the random stream of the normal generator.- Specified by:
getStreamin classStochasticProcess
-
getMu
public double getMu()
Returns the value of μ.
-
getSigma
public double getSigma()
Returns the value of σ.
-
getGen
public NormalGen getGen()
Returns the normal random variate generator used. TheRandomStreamused by that generator can be changed via getGen().setStream(stream), for example.
-
-
DMelt 3.0 © DataMelt by jWork.ORG