SSJ API Documentation
Stochastic Simulation in Java
Loading...
Searching...
No Matches
Pearson6Gen.java
1/*
2 * Class: Pearson6Gen
3 * Description: random variate generators for the Pearson type VI 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
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.randvar;
26
27import umontreal.ssj.rng.*;
28import umontreal.ssj.probdist.*;
29
48public class Pearson6Gen extends RandomVariateGen {
49 protected double alpha1;
50 protected double alpha2;
51 protected double beta;
52
59 public Pearson6Gen(RandomStream s, double alpha1, double alpha2, double beta) {
60 super(s, new Pearson6Dist(alpha1, alpha2, beta));
61 setParams(alpha1, alpha2, beta);
62 }
63
70 public Pearson6Gen(RandomStream s, double alpha1, double alpha2) {
71 this(s, alpha1, alpha2, 1.0);
72 }
73
78 super(s, dist);
79 if (dist != null)
80 setParams(dist.getAlpha1(), dist.getAlpha2(), dist.getBeta());
81 }
82
88 public static double nextDouble(RandomStream s, double alpha1, double alpha2, double beta) {
89 return Pearson6Dist.inverseF(alpha1, alpha2, beta, s.nextDouble());
90 }
91
95 public double getAlpha1() {
96 return alpha1;
97 }
98
102 public double getAlpha2() {
103 return alpha2;
104 }
105
109 public double getBeta() {
110 return beta;
111 }
112
118 public void setParams(double alpha1, double alpha2, double beta) {
119 if (alpha1 <= 0.0)
120 throw new IllegalArgumentException("alpha1 <= 0");
121 if (alpha2 <= 0.0)
122 throw new IllegalArgumentException("alpha2 <= 0");
123 if (beta <= 0.0)
124 throw new IllegalArgumentException("beta <= 0");
125 this.alpha1 = alpha1;
126 this.alpha2 = alpha2;
127 this.beta = beta;
128 }
129}
Extends the class ContinuousDistribution for the Pearson type VI distribution with shape parameters ...
double inverseF(double u)
Returns the inverse distribution function .
double getBeta()
Returns the parameter of this object.
Pearson6Gen(RandomStream s, double alpha1, double alpha2)
Creates a Pearson6 random variate generator with parameters.
double getAlpha2()
Returns the parameter of this object.
Pearson6Gen(RandomStream s, double alpha1, double alpha2, double beta)
Creates a Pearson6 random variate generator with parameters.
Pearson6Gen(RandomStream s, Pearson6Dist dist)
Creates a new generator for the distribution dist, using stream s.
double getAlpha1()
Returns the parameter of this object.
static double nextDouble(RandomStream s, double alpha1, double alpha2, double beta)
Generates a variate from the Pearson VI distribution with shape parameters and , and scale parameter...
void setParams(double alpha1, double alpha2, double beta)
Sets the parameters , and.
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,...