Utility
Class ChiSquare

java.lang.Object
  |
  +--Utility.RandomNumber
        |
        +--Utility.ChiSquare

public class ChiSquare
extends RandomNumber

ChiSquare is used to generate random variables from the chi-squared distribution. A specific chi-squared distribution is characterized by a single parameter, the degrees of freedom.

This is a continuous distribution.

Tests Performed
1000 samples were generated and the means and variances were examined. Subjectively, they seemed correct. Goodness of fit tests where not performed.


Constructor Summary
ChiSquare(int degsFreedom)
          ChiSquare constructor.
 
Method Summary
 double sampleDouble()
          The sampleDouble function returns a random variable that is chosen from a chi-squared distribution with degrees of freedom as set in the constructor.
 int sampleInt()
          The sampleInt function should not be called for this continuous distribution.
 
Methods inherited from class Utility.RandomNumber
goodnessOfFitTest, goodnessOfFitTest, randomMixer, resetRandomMixer, sample01
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChiSquare

public ChiSquare(int degsFreedom)
ChiSquare constructor. Initialize the degrees of freedom for the distribution.

Parameters:
degsFreedom - The degrees of freedom of the distribution.
Method Detail

sampleDouble

public double sampleDouble()
The sampleDouble function returns a random variable that is chosen from a chi-squared distribution with degrees of freedom as set in the constructor.
Algorithm is found in Knuth, "The Art of Comp. Programming" Volume 2.

Overrides:
sampleDouble in class RandomNumber
See Also:
ChiSquare(int)

sampleInt

public int sampleInt()
The sampleInt function should not be called for this continuous distribution.

Overrides:
sampleInt in class RandomNumber