All Downloads are FREE. Search and download functionalities are using the official Maven repository.

umontreal.iro.lecuyer.randvar.FNoncentralGen Maven / Gradle / Ivy

Go to download

SSJ is a Java library for stochastic simulation, developed under the direction of Pierre L'Ecuyer, in the Département d'Informatique et de Recherche Opérationnelle (DIRO), at the Université de Montréal. It provides facilities for generating uniform and nonuniform random variates, computing different measures related to probability distributions, performing goodness-of-fit tests, applying quasi-Monte Carlo methods, collecting (elementary) statistics, and programming discrete-event simulations with both events and processes.

The newest version!


/*
 * Class:        FNoncentralGen
 * Description:  random variate generators for the noncentral F-distribution
 * Environment:  Java
 * Software:     SSJ 
 * Copyright (C) 2001  Pierre L'Ecuyer and Université de Montréal
 * Organization: DIRO, Université de Montréal
 * @author       
 * @since

 * SSJ is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License (GPL) as published by the
 * Free Software Foundation, either version 3 of the License, or
 * any later version.

 * SSJ is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * A copy of the GNU General Public License is available at
   GPL licence site.
 */

package umontreal.iro.lecuyer.randvar;
import umontreal.iro.lecuyer.rng.*;
import umontreal.iro.lecuyer.probdist.*;


/**
 * This class implements random variate generators for the 
 * noncentral F-distribution.
 * If X is a noncentral chi-square random variable with ν1 > 0 degrees of 
 * freedom and noncentrality parameter 
 * λ > 0, and Y is a chi-square 
 * random variable (statistically independent of X) with ν2 > 0 degrees
 *  of freedom, then
 * 
 * 

*
* F ' = (X/ν1)/(Y/ν2) *

* has a noncentral F-distribution. * */ public class FNoncentralGen extends RandomVariateGen { private ChiSquareNoncentralGen noncenchigen; private ChiSquareGen chigen; private double nu1; // degrees of freedom of noncenchigen private int nu2; // degrees of freedom of chigen public double nextDouble() { double x = noncenchigen.nextDouble(); double y = chigen.nextDouble(); return (x * nu2) / (y * nu1); } /** * Creates a noncentral-F random variate generator * using noncentral chi-square generator ncgen and * chi-square generator cgen. * */ public FNoncentralGen (ChiSquareNoncentralGen ncgen, ChiSquareGen cgen) { super (null, null); setChiSquareNoncentralGen (ncgen); setChiSquareGen (cgen); } /** * Sets the noncentral chi-square generator to ncgen. * */ public void setChiSquareNoncentralGen (ChiSquareNoncentralGen ncgen) { nu1 = ncgen.getNu(); noncenchigen = ncgen; } /** * Sets the chi-square generator to cgen. * */ public void setChiSquareGen (ChiSquareGen cgen) { nu2 = cgen.getN(); chigen = cgen; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy