SSJ API Documentation
Stochastic Simulation in Java
Loading...
Searching...
No Matches
FNoncentralGen.java
1/*
2 * Class: FNoncentralGen
3 * Description: random variate generators for the noncentral F-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
44public class FNoncentralGen extends RandomVariateGen {
45 private ChiSquareNoncentralGen noncenchigen;
46 private ChiSquareGen chigen;
47 private double nu1; // degrees of freedom of noncenchigen
48 private int nu2; // degrees of freedom of chigen
49
50 public double nextDouble() {
51 double x = noncenchigen.nextDouble();
52 double y = chigen.nextDouble();
53 return (x * nu2) / (y * nu1);
54 }
55
61 super(null, null);
63 setChiSquareGen(cgen);
64 }
65
70 nu1 = ncgen.getNu();
71 noncenchigen = ncgen;
72 }
73
77 public void setChiSquareGen(ChiSquareGen cgen) {
78 nu2 = cgen.getN();
79 chigen = cgen;
80 }
81
82}
This class implements random variate generators with the chi square distribution with degrees of fre...
int getN()
Returns the value of for this object.
This class implements random variate generators for the noncentral chi square distribution with degr...
double getNu()
Returns the value of of this object.
double nextDouble()
Generates a random number from the continuous distribution contained in this object.
void setChiSquareGen(ChiSquareGen cgen)
Sets the chi-square generator to cgen.
FNoncentralGen(ChiSquareNoncentralGen ncgen, ChiSquareGen cgen)
Creates a noncentral-F random variate generator using noncentral chi-square generator ncgen and chi-s...
void setChiSquareNoncentralGen(ChiSquareNoncentralGen ncgen)
Sets the noncentral chi-square generator to ncgen.