Example #1
0
 public double nextObservation() {
   double x = path[observationIndex];
   x += mudt[observationIndex] + sigmasqrdt[observationIndex] * gen.nextDouble();
   observationIndex++;
   path[observationIndex] = x;
   return x;
 }
Example #2
0
 public double[] generatePath() {
   double x = x0;
   for (int j = 0; j < d; j++) {
     x += mudt[j] + sigmasqrdt[j] * gen.nextDouble();
     path[j + 1] = x;
   }
   observationIndex = d;
   observationCounter = d;
   return path;
 }
Example #3
0
 /**
  * Generates and returns the next observation at time @f$t_{j+1} =@f$ `nextTime`. It uses the
  * previous observation time @f$t_j@f$ defined earlier (either by this method or by
  * <tt>setObservationTimes</tt>), as well as the value of the previous observation @f$X(t_j)@f$.
  * *Warning*: This method will reset the observations time @f$t_{j+1}@f$ for this process to
  * `nextTime`. The user must make sure that the @f$t_{j+1}@f$ supplied is @f$\geq t_j@f$.
  */
 public double nextObservation(double nextTime) {
   // This method is useful for generating variance gamma processes
   double x = path[observationIndex];
   double previousTime = t[observationIndex];
   observationIndex++;
   t[observationIndex] = nextTime;
   double dt = nextTime - previousTime;
   x += mu * dt + sigma * Math.sqrt(dt) * gen.nextDouble();
   path[observationIndex] = x;
   return x;
 }
Example #4
0
 /** Returns the random stream of the normal generator. */
 public RandomStream getStream() {
   return gen.getStream();
 }
Example #5
0
 /** Resets the random stream of the normal generator to `stream`. */
 public void setStream(RandomStream stream) {
   gen.setStream(stream);
 }
Example #6
0
 public double[] generatePath(RandomStream stream) {
   gen.setStream(stream);
   return generatePath();
 }
Example #7
0
 /**
  * Generates an observation of the process in `dt` time units, assuming that the process has
  * value @f$x@f$ 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).
  */
 public double nextObservation(double x, double dt) {
   x += mu * dt + sigma * Math.sqrt(dt) * gen.nextDouble();
   return x;
 }