SSJ API Documentation
Stochastic Simulation in Java
Loading...
Searching...
No Matches
InverseGaussianProcessPCA.java
1/*
2 * Class: InverseGaussianProcessPCA
3 * Description:
4 * Environment: Java
5 * Software: SSJ
6 * Copyright (C) 2001 Pierre L'Ecuyer and Universite de Montreal
7 * Organization: DIRO, Universite de Montreal
8 * @author
9 * @since
10 *
11 *
12 * Licensed under the Apache License, Version 2.0 (the "License");
13 * you may not use this file except in compliance with the License.
14 * You may obtain a copy of the License at
15 *
16 * http://www.apache.org/licenses/LICENSE-2.0
17 *
18 * Unless required by applicable law or agreed to in writing, software
19 * distributed under the License is distributed on an "AS IS" BASIS,
20 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 * See the License for the specific language governing permissions and
22 * limitations under the License.
23 *
24 */
25package umontreal.ssj.stochprocess;
26
27import umontreal.ssj.rng.*;
28import umontreal.ssj.probdist.*;
29import umontreal.ssj.randvar.*;
30
46public class InverseGaussianProcessPCA extends InverseGaussianProcess {
47
48 protected BrownianMotionPCA bmPCA;
49
54 public InverseGaussianProcessPCA(double s0, double delta, double gamma, RandomStream stream) {
55 super(s0, delta, gamma, stream);
56 bmPCA = new BrownianMotionPCA(0., 0., delta, stream);
57 numberOfRandomStreams = 1;
58 }
59
60 public double[] generatePath() {
61 double[] uniformIncrement = new double[d];
62 double[] BMpath = bmPCA.generatePath();
63
64 for (int i = 0; i < d; i++) {
65 double dt = bmPCA.mudt[i]; // bmTime[i + 1] - bmTime[i];
66 double sigma = bmPCA.sigmasqrdt[i];// Math.sqrt(dt) * bmSigma;
67 uniformIncrement[i] = NormalDistQuick.cdf01((BMpath[i + 1] - BMpath[i] - bmPCA.mu * dt) / sigma);
68 }
69 path[0] = x0;
70 for (int i = 0; i < d; i++)
71 path[i + 1] = path[i] + InverseGaussianDist.inverseF(imu[i], ilam[i], uniformIncrement[i]);
72
73 observationIndex = d;
74 observationCounter = d;
75 return path;
76 }
77
84 public double[] generatePath(double[] uniforms01) {
85 double[] uniformIncrement = new double[d];
86 double[] BMpath = bmPCA.generatePath(uniforms01);
87
88 for (int i = 0; i < d; i++) {
89 double dt = bmPCA.mudt[i]; // bmTime[i + 1] - bmTime[i];
90 double sigma = bmPCA.sigmasqrdt[i];// Math.sqrt(dt) * bmSigma;
91 uniformIncrement[i] = NormalDistQuick.cdf01((BMpath[i + 1] - BMpath[i] - bmPCA.mu * dt) / sigma);
92 }
93 path[0] = x0;
94 for (int i = 0; i < d; i++)
95 path[i + 1] = path[i] + InverseGaussianDist.inverseF(imu[i], ilam[i], uniformIncrement[i]);
96
97 observationIndex = d;
98 observationCounter = d;
99 return path;
100 }
101
105 public double nextObservation() {
106 throw new UnsupportedOperationException("Not implementable for PCA.");
107 }
108
115 public void setObservationTimes(double t[], int d) {
116 super.setObservationTimes(t, d);
117 bmPCA.setObservationTimes(t, d);
118 }
119
121 if (stream != bmPCA.getStream())
122 throw new IllegalStateException("Two different streams or more are present");
123 return stream;
124 }
125
126 public void setStream(RandomStream stream) {
127 super.setStream(stream);
128 bmPCA.setStream(stream);
129 }
130
138 this.bmPCA = bmPCA;
139 }
140
145 return bmPCA;
146 }
147
148}
Extends the class ContinuousDistribution for the inverse Gaussian distribution with location paramete...
double inverseF(double u)
Returns the inverse distribution function .
A variant of the class NormalDist (for the normal distribution with mean and variance ).
static double cdf01(double x)
Same as cdf(0.0, 1.0, x).
A Brownian motion process sampled using the principal component decomposition (PCA) fgla04a,...
This class represents a Brownian motion process , sampled at times .
BrownianMotion getBrownianMotionPCA()
Returns the BrownianMotionPCA.
void setStream(RandomStream stream)
Resets the random stream of the underlying generator to stream.
double[] generatePath(double[] uniforms01)
Instead of using the internal stream to generate the path, uses an array of uniforms .
double[] generatePath()
Generates, returns, and saves the sample path .
void setBrownianMotionPCA(BrownianMotionPCA bmPCA)
Sets the brownian motion PCA.
void setObservationTimes(double t[], int d)
Sets the observation times of both the.
InverseGaussianProcessPCA(double s0, double delta, double gamma, RandomStream stream)
Constructs a new InverseGaussianProcessPCA.
RandomStream getStream()
Returns the random stream of the underlying generator.
This interface defines the basic structures to handle multiple streams of uniform (pseudo)random numb...