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

umontreal.iro.lecuyer.randvar.FisherFGen 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:        FisherFGen
 * Description:  random variate generators for the Fisher 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 
 * Fisher F distribution with n and m
 * degrees of freedom, where n and m are positive integers.
 * The density function of this distribution is
 * 
 * 

*
* f (x) = Γ((n + m)/2)nn/2mm/2/[Γ(n/2)Γ(m/2)]x(n-2)/2/(m + nx)(n+m)/2,         for x > 0. *

* */ public class FisherFGen extends RandomVariateGen { protected int n = -1; protected int m = -1; /** * Creates a Fisher F random variate generator with * n and m degrees of freedom, using stream s. * */ public FisherFGen (RandomStream s, int n, int m) { super (s, new FisherFDist(n, m)); setParams (n, m); } /** * Creates a new generator for the distribution dist, * using stream s. * */ public FisherFGen (RandomStream s, FisherFDist dist) { super (s, dist); if (dist != null) setParams (dist.getN(), dist.getM()); } /** * Generates a variate from the Fisher F distribution with * n and m degrees of freedom, using stream s. * */ public static double nextDouble (RandomStream s, int n, int m) { return FisherFDist.inverseF (n, m, 15, s.nextDouble()); } /** * Returns the parameter n of this object. * */ public int getN() { return n; } /** * Returns the parameter p of this object. * * */ public int getM() { return m; } /** * Sets the parameters n and m of this object. * */ protected void setParams (int n, int m) { if (m <= 0) throw new IllegalArgumentException ("m <= 0"); if (n <= 0) throw new IllegalArgumentException ("n <= 0"); this.m = m; this.n = n; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy