SSJ API Documentation
Stochastic Simulation in Java
Loading...
Searching...
No Matches
ChiSquareNoncentralGen.java
1/*
2 * Class: ChiSquareNoncentralGen
3 * Description: random variate generators for the noncentral chi square 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
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
41public class ChiSquareNoncentralGen extends RandomVariateGen {
42 protected double nu = -1.0;
43 protected double lambda = -1.0;
44
51 public ChiSquareNoncentralGen(RandomStream s, double nu, double lambda) {
52 super(s, new ChiSquareNoncentralDist(nu, lambda));
53 setParams(nu, lambda);
54 }
55
60 super(s, dist);
61 if (dist != null)
62 setParams(dist.getNu(), dist.getLambda());
63 }
64
70 public static double nextDouble(RandomStream s, double nu, double lambda) {
71 return ChiSquareNoncentralDist.inverseF(nu, lambda, s.nextDouble());
72 }
73
77 public double getNu() {
78 return nu;
79 }
80
84 public double getLambda() {
85 return lambda;
86 }
87
92 protected void setParams(double nu, double lambda) {
93 if (nu <= 0.0)
94 throw new IllegalArgumentException("nu <= 0");
95 if (lambda < 0.0)
96 throw new IllegalArgumentException("lambda < 0");
97 this.nu = nu;
98 this.lambda = lambda;
99 }
100}
Extends the class ContinuousDistribution for the noncentral chi-square distribution with degrees of ...
double inverseF(double u)
Returns the inverse distribution function .
static double nextDouble(RandomStream s, double nu, double lambda)
Generates a new variate from the noncentral chi square distribution with nu = degrees of freedom and...
void setParams(double nu, double lambda)
Sets the parameters nu and lambda of this object.
double getLambda()
Returns the value of for this object.
ChiSquareNoncentralGen(RandomStream s, ChiSquareNoncentralDist dist)
Create a new generator for the distribution dist and stream s.
ChiSquareNoncentralGen(RandomStream s, double nu, double lambda)
Creates a noncentral chi square random variate generator with nu.
double getNu()
Returns the value of 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,...