/* *
* Title:
* Description:
* Copyright: Copyright (c)
* Company:
* @author
* @version 1.0
*/
package umontreal.iro.lecuyer.stochprocess;
import umontreal.iro.lecuyer.rng.*;
import umontreal.iro.lecuyer.probdist.*;
import umontreal.iro.lecuyer.randvar.*;
import umontreal.iro.lecuyer.stat.*;
import umontreal.iro.lecuyer.stat.list.*;
/**
* Represents a gamma process sampled using the principal
* component analysis (PCA). To simulate the gamma process at times
*
* t0 < t1 < ... < td by PCA sampling, a Brownian
* motion
* {W(t), t >= 0} with mean 0 and variance parameter ν is
* first generated at times
* t0 < t1 < ... < td
* by PCA sampling (see class {@link BrownianMotionPCA}).
* The independent increments
* W(tj) - W(tj-1) of this process
* are then transformed into independent U(0, 1) random variates Vj via
*
*
*
* Vj = Φ((τ_j-τ_j-1)1/2[W(τj) - W(τj-1)]), j = 1,..., s
*
* Finally, the increments of the Gamma process are computed as
*
* Y(tj) - Y(tj-1) = G-1(Vj), where G is the gamma distribution
* function.
*
*/
public class GammaProcessPCA extends GammaProcess {
double[] arrayTime;
BrownianMotionPCA BMPCA;
/**
* Constructs a new GammaProcessPCA with parameters
*
* μ = mu ,
* ν = nu and initial value
* S(t0) = s0 .
* The random variables are created using stream.
* Note that the same {@link umontreal.iro.lecuyer.rng.RandomStream RandomStream}
* is used for the GammaProcessPCA and for the
* {@link BrownianMotionPCA} included in this class. Both the
* {@link GammaProcessPCA} and the {@link BrownianMotionPCA} are generated by
* inversion.
*
*/
public GammaProcessPCA (double s0, double mu, double nu,
RandomStream stream) {
super (s0, mu, nu, new GammaGen (stream, new GammaDist (1.0)));
this.BMPCA = new BrownianMotionPCA(0.0, 0.0, Math.sqrt(nu), stream);
}
/**
* Constructs a new GammaProcessPCA with parameters
*
* μ = mu ,
* ν = nu and initial value
* S(t0) = s0 .
* All the random variables, i.e. the gamma ones and the normal ones,
* are created using the {@link umontreal.iro.lecuyer.rng.RandomStream RandomStream}
* included in the {@link umontreal.iro.lecuyer.randvar.GammaGen GammaGen}
* Ggen. Note that the parameters of the
* {@link umontreal.iro.lecuyer.randvar.GammaGen GammaGen} object
* are not important since the implementation forces the generator
* to use the correct parameters (as defined above).
*
*/
public GammaProcessPCA (double s0, double mu, double nu, GammaGen Ggen) {
super(s0, mu, nu, Ggen);
this.BMPCA = new BrownianMotionPCA(0.0, 0.0, Math.sqrt(nu), Ggen.getStream());
}
public double[] generatePath() {
double[] uniformsV = new double[d];
arrayTime = BMPCA.getObservationTimes();
int i;
double[] BMpath = BMPCA.generatePath();
double sigma;
for(i = 0; i < d; i++){
sigma = BMPCA.getSigma() * Math.sqrt(arrayTime[i + 1] - arrayTime[i]);
uniformsV[i] = NormalDist.cdf01( ( BMpath[i+1] - BMpath[i] )/sigma);
}
path[0] = x0;
for(i = 0; i < d; i++){
path[i+1] = path[i] +
GammaDist.inverseF(mu2dtOverNu[i], muOverNu, 10, uniformsV[i]);
}
observationIndex = d;
observationCounter = d;
return path;
}
public double[] generatePath (double[] uniform01) {
double[] uniformsV = new double[d];
arrayTime = BMPCA.getObservationTimes();
int i;
double[] BMpath = BMPCA.generatePath(uniform01);
double sigma;
for(i = 0; i < d; i++){
sigma = BMPCA.getSigma() * Math.sqrt(arrayTime[i + 1] - arrayTime[i]);
uniformsV[i] = NormalDist.cdf01( ( BMpath[i+1] - BMpath[i] )/sigma);
}
path[0] = x0;
for(i = 0; i < d; i++){
path[i+1] = path[i] +
GammaDist.inverseF(mu2dtOverNu[i], muOverNu, 10, uniformsV[i]);
}
observationIndex = d;
observationCounter = d;
return path;
}
/**
* This method is not implemented in this class since the path
* cannot be generated sequentially.
*
*/
public double nextObservation() {
throw new UnsupportedOperationException ("nextObservation is not implemented in GammaProcessPCA");
}
/**
* This method is not implemented in this class since the path
* cannot be generated sequentially.
*
*/
public double nextObservation (double nextT) {
throw new UnsupportedOperationException ("nextObservation is not implemented in GammaProcessPCA");
}
/**
* Returns the {@link BrownianMotionPCA} that is included in the
* {@link GammaProcessPCA} object.
*
*/
public BrownianMotionPCA getBMPCA() {
return BMPCA;
}
/**
* Sets the observation times of the {@link GammaProcessPCA} and the
* {@link BrownianMotionPCA}.
*
*/
public void setObservationTimes (double[] t, int d) {
super.setObservationTimes(t, d);
BMPCA.setObservationTimes(t, d);
}
/**
* Sets the parameters s0, μ and ν to new values, and sets
* the variance parameters of the {@link BrownianMotionPCA} to ν.
*
*/
public void setParams (double s0, double mu, double nu) {
super.setParams(s0, mu, nu);
BMPCA.setParams(0.0, 0.0, Math.sqrt(nu));
}
/**
* Resets the {@link umontreal.iro.lecuyer.rng.RandomStream RandomStream}
* of the gamma generator and the
* {@link umontreal.iro.lecuyer.rng.RandomStream RandomStream} of
* the inner {@link BrownianMotionPCA} to
* stream.
*
*/
public void setStream (RandomStream stream) {
super.setStream(stream);
this.BMPCA.setStream(stream);
}
}
Ads help maintain this website.