25package umontreal.ssj.stochprocess;
27import umontreal.ssj.rng.*;
28import umontreal.ssj.probdist.*;
29import umontreal.ssj.randvar.*;
56 protected double mu, sigma;
58 protected double[] mudt, sigmasqrdt;
70 this(x0, mu, sigma,
new NormalGen(stream));
90 double x = path[observationIndex];
91 x += mudt[observationIndex] + sigmasqrdt[observationIndex] * gen.nextDouble();
93 path[observationIndex] = x;
107 double x = path[observationIndex];
108 double previousTime = t[observationIndex];
110 t[observationIndex] = nextTime;
111 double dt = nextTime - previousTime;
112 x += mu * dt + sigma * Math.sqrt(dt) * gen.nextDouble();
113 path[observationIndex] = x;
124 x += mu * dt + sigma * Math.sqrt(dt) * gen.nextDouble();
130 for (
int j = 0; j < d; j++) {
131 x += mudt[j] + sigmasqrdt[j] * gen.nextDouble();
134 observationIndex = d;
135 observationCounter = d;
146 for (
int j = 0; j < d; j++) {
150 observationIndex = d;
151 observationCounter = d;
156 gen.setStream(stream);
166 public void setParams(
double x0,
double mu,
double sigma) {
170 throw new IllegalArgumentException(
"sigma <= 0");
172 if (observationTimesSet)
180 gen.setStream(stream);
187 return gen.getStream();
216 protected void init() {
218 mudt =
new double[d];
219 sigmasqrdt =
new double[d];
220 for (
int j = 0; j < d; j++) {
221 double dt = t[j + 1] - t[j];
223 sigmasqrdt[j] = sigma * Math.sqrt(dt);
Extends the class ContinuousDistribution for the normal distribution (e.g., tjoh95a (page 80)).
static double inverseF01(double u)
Same as inverseF(0, 1, u).
This class implements methods for generating random variates from the normal distribution .
void setStream(RandomStream stream)
Resets the random stream of the normal generator to stream.
double getMu()
Returns the value of .
double nextObservation(double nextTime)
Generates and returns the next observation at time nextTime.
double nextObservation(double x, double dt)
Generates an observation of the process in dt time units, assuming that the process has value at the...
RandomStream getStream()
Returns the random stream of the normal generator.
double[] generatePath()
Generates, returns, and saves the sample path .
NormalGen getGen()
Returns the normal random variate generator used.
double[] generatePath(RandomStream stream)
Same as generatePath(), but first resets the stream to stream.
double getSigma()
Returns the value of .
double nextObservation()
Generates and returns the next observation of the stochastic process.
BrownianMotion(double x0, double mu, double sigma, NormalGen gen)
Constructs a new BrownianMotion with parameters mu,.
void setParams(double x0, double mu, double sigma)
Resets the parameters , and of the process.
double[] generatePath(double[] uniform01)
Same as generatePath(), but a vector of uniform random numbers must be provided to the method.
BrownianMotion(double x0, double mu, double sigma, RandomStream stream)
Constructs a new BrownianMotion with parameters mu,.
Abstract base class for a stochastic process sampled (or observed) at a finite number of time points...
This interface defines the basic structures to handle multiple streams of uniform (pseudo)random numb...