25package umontreal.ssj.stochprocess;
27import umontreal.ssj.rng.*;
28import umontreal.ssj.probdist.*;
29import umontreal.ssj.randvar.*;
40 protected double mu2OverNu, mu2dTOverNu;
41 protected double[] bMu2dtOverNuL,
43 protected int[] wIndexList;
54 super(s0, mu, nu, stream);
60 double[] uniformsV =
new double[d + 1];
63 double[] BMPCApath = BMPCA.generatePath(uniform01);
69 for (
int j = 0; j < 3 * (d - 1); j += 3) {
70 oldIndexL = BMBridge.wIndexList[j];
71 newIndex = BMBridge.wIndexList[j + 1];
72 oldIndexR = BMBridge.wIndexList[j + 2];
74 temp = BMPCApath[newIndex] - BMPCApath[oldIndexL];
75 temp -= (BMPCApath[oldIndexR] - BMPCApath[oldIndexL]) * BMBridge.wMuDt[newIndex];
76 temp /= BMBridge.wSqrtDt[newIndex];
79 double dT = BMPCA.t[d] - BMPCA.t[0];
80 uniformsV[d] =
NormalDist.
cdf01((BMPCApath[d] - BMPCApath[0] - BMPCA.mu * dT) / (BMPCA.sigma * Math.sqrt(dT)));
85 for (
int j = 0; j < 3 * (d - 1); j += 3) {
86 oldIndexL = wIndexList[j];
87 newIndex = wIndexList[j + 1];
88 oldIndexR = wIndexList[j + 2];
90 y =
BetaDist.
inverseF(bMu2dtOverNuL[newIndex], bMu2dtOverNuR[newIndex], 8, uniformsV[newIndex]);
92 path[newIndex] = path[oldIndexL] + (path[oldIndexR] - path[oldIndexL]) * y;
95 observationCounter = d;
100 double[] u =
new double[d];
101 for (
int i = 0; i < d; i++)
102 u[i] = stream.nextDouble();
106 public void setParams(
double s0,
double mu,
double nu) {
107 super.setParams(s0, mu, nu);
108 BMBridge.setParams(0.0, 0.0, Math.sqrt(nu));
109 BMPCA.setParams(0.0, 0.0, Math.sqrt(nu));
113 super.setObservationTimes(t, d);
114 BMBridge.setObservationTimes(t, d);
124 protected void init() {
126 if (observationTimesSet) {
129 bMu2dtOverNuL =
new double[d + 1];
130 bMu2dtOverNuR =
new double[d + 1];
131 wIndexList =
new int[3 * d];
133 int[] ptIndex =
new int[d + 1];
134 int indexCounter = 0;
135 int newIndex, oldLeft, oldRight;
140 mu2OverNu = mu * mu / nu;
141 mu2dTOverNu = mu2OverNu * (t[d] - t[0]);
143 for (
int powOfTwo = 1; powOfTwo <= d / 2; powOfTwo *= 2) {
145 for (
int j = powOfTwo; j >= 1; j--) {
146 ptIndex[2 * j] = ptIndex[j];
150 for (
int j = 1; j <= powOfTwo; j++) {
153 newIndex = (int) (0.5 * (ptIndex[oldLeft] + ptIndex[oldRight]));
155 bMu2dtOverNuL[newIndex] = mu * mu * (t[newIndex] - t[ptIndex[oldLeft]]) / nu;
156 bMu2dtOverNuR[newIndex] = mu * mu * (t[ptIndex[oldRight]] - t[newIndex]) / nu;
158 ptIndex[oldLeft + 1] = newIndex;
159 wIndexList[indexCounter] = ptIndex[oldLeft];
160 wIndexList[indexCounter + 1] = newIndex;
161 wIndexList[indexCounter + 2] = ptIndex[oldRight];
167 for (
int k = 1; k < d; k++) {
168 if (ptIndex[k - 1] + 1 < ptIndex[k]) {
171 bMu2dtOverNuL[ptIndex[k - 1] + 1] = mu * mu * (t[ptIndex[k - 1] + 1] - t[ptIndex[k - 1]]) / nu;
172 bMu2dtOverNuR[ptIndex[k - 1] + 1] = mu * mu * (t[ptIndex[k]] - t[ptIndex[k - 1] + 1]) / nu;
174 wIndexList[indexCounter] = ptIndex[k] - 2;
175 wIndexList[indexCounter + 1] = ptIndex[k] - 1;
176 wIndexList[indexCounter + 2] = ptIndex[k];
Extends the class ContinuousDistribution for the beta distribution.
double inverseF(double u)
Returns the inverse distribution function .
Extends the class ContinuousDistribution for the gamma distribution tjoh95a (page 337) with shape pa...
double inverseF(double u)
Returns the inverse distribution function .
Extends the class ContinuousDistribution for the normal distribution (e.g., tjoh95a (page 80)).
static double cdf01(double x)
Same as cdf(0, 1, x).
Represents a Brownian motion process sampled using the bridge sampling technique (see for example.
A Brownian motion process sampled using the principal component decomposition (PCA) fgla04a,...
void setObservationTimes(double[] t, int d)
Sets the observation times of the GammaProcessPCA and the.
BrownianMotionPCA getBMPCA()
Returns the inner BrownianMotionPCA.
double[] generatePath(double[] uniform01)
Generates, returns and saves the path .
void setParams(double s0, double mu, double nu)
Sets the parameters s0, and to new values, and sets the variance parameters of the BrownianMotionPC...
GammaProcessPCABridge(double s0, double mu, double nu, RandomStream stream)
Constructs a new GammaProcessPCABridge with parameters , and initial value .
double[] generatePath()
Generates, returns and saves the path .
GammaProcessPCA(double s0, double mu, double nu, RandomStream stream)
Constructs a new GammaProcessPCA with parameters , and initial value .
This interface defines the basic structures to handle multiple streams of uniform (pseudo)random numb...