SSJ API Documentation
Stochastic Simulation in Java
Loading...
Searching...
No Matches
NormalInverseGaussianGen.java
1/*
2 * Class: NormalInverseGaussianGen
3 * Description: random variate generators for the normal inverse gaussian distribution
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 Richard Simard
9 * @since June 2008
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.randvar;
26
27import umontreal.ssj.rng.*;
28import umontreal.ssj.probdist.*;
29
40public class NormalInverseGaussianGen extends RandomVariateGen {
41 protected double mu;
42 protected double delta = -1.0;
43 protected double alpha = -1.0;
44 protected double beta = -2.0;
45 protected double gamma = -1.0;
46
53 public NormalInverseGaussianGen(RandomStream s, double alpha, double beta, double mu, double delta) {
54 super(s, new NormalInverseGaussianDist(alpha, beta, mu, delta));
55 setParams(alpha, beta, mu, delta);
56 }
57
62 super(s, dist);
63 if (dist != null)
64 setParams(dist.getAlpha(), dist.getBeta(), dist.getMu(), dist.getDelta());
65 }
66
70 public static double nextDouble(RandomStream s, double alpha, double beta, double mu, double delta) {
71 return NormalInverseGaussianDist.inverseF(alpha, beta, mu, delta, s.nextDouble());
72 }
73
77 public double getAlpha() {
78 return alpha;
79 }
80
84 public double getBeta() {
85 return beta;
86 }
87
91 public double getMu() {
92 return mu;
93 }
94
98 public double getDelta() {
99 return delta;
100 }
101
107 public void setParams(double alpha, double beta, double mu, double delta) {
108 if (delta <= 0.0)
109 throw new IllegalArgumentException("delta <= 0");
110 if (alpha <= 0.0)
111 throw new IllegalArgumentException("alpha <= 0");
112 if (Math.abs(beta) >= alpha)
113 throw new IllegalArgumentException("|beta| >= alpha");
114
115 gamma = Math.sqrt(alpha * alpha - beta * beta);
116
117 this.mu = mu;
118 this.delta = delta;
119 this.beta = beta;
120 this.alpha = alpha;
121 }
122
123}
Extends the class ContinuousDistribution for the normal inverse gaussian distribution with location p...
static double inverseF(double alpha, double beta, double mu, double delta, double u)
NOT IMPLEMENTED.
void setParams(double alpha, double beta, double mu, double delta)
Sets the parameters , , and.
NormalInverseGaussianGen(RandomStream s, double alpha, double beta, double mu, double delta)
Creates an normal inverse gaussian random variate generator with parameters = alpha,...
static double nextDouble(RandomStream s, double alpha, double beta, double mu, double delta)
NOT IMPLEMENTED.
double getMu()
Returns the parameter of this object.
NormalInverseGaussianGen(RandomStream s, NormalInverseGaussianDist dist)
Creates a new generator for the distribution dist, using stream s.
double getBeta()
Returns the parameter of this object.
double getDelta()
Returns the parameter of this object.
double getAlpha()
Returns the parameter of this object.
This interface defines the basic structures to handle multiple streams of uniform (pseudo)random numb...
double nextDouble()
Returns a (pseudo)random number from the uniform distribution over the interval , using this stream,...