org.jscience.mathematics.statistics
Class ChiSquareDistribution

java.lang.Object
  extended by org.jscience.mathematics.statistics.Distribution
      extended by org.jscience.mathematics.statistics.GammaDistribution
          extended by org.jscience.mathematics.statistics.ChiSquareDistribution
All Implemented Interfaces:
java.io.Serializable

public class ChiSquareDistribution
extends GammaDistribution
implements java.io.Serializable

This class defines the chi-square distribution with a specifed degrees of freedom parameter.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.jscience.mathematics.statistics.Distribution
CONTINUOUS, DISCRETE, MIXED
 
Constructor Summary
ChiSquareDistribution()
          This default constructor creates a new chi-square distribution with 1 degree of freedom.
ChiSquareDistribution(int n)
          This general constructor creates a new chi-square distribuiton with a specified degrees of freedom parameter.
 
Method Summary
 int getDegrees()
          This method returns the degrees of freedom parameter.
 void setDegrees(int n)
          This method sets the degrees of freedom parameter and computes the defaut domain.
 void setParameters(double k, double b)
          This method sets the gamma parameters, which must be related to the degrees of freedom.
 void setScale(double b)
          This method sets the scale parameter, which must be 2.
 void setShape(double k)
          This method sets the shape parameter, which must be n/2, where n is the degrees of freedom.
 double simulate()
          This method simulates a value from the distribuiton, as the sum of squares of independent, standard normal distribution.
 java.lang.String toString()
          This method returns a string that gives the name of the distribution and the values of the parameters.
 
Methods inherited from class org.jscience.mathematics.statistics.GammaDistribution
getCDF, getDensity, getMaxDensity, getMean, getMGF, getMoment, getMoment, getScale, getShape, getVariance
 
Methods inherited from class org.jscience.mathematics.statistics.Distribution
getDomain, getFailureRate, getMedian, getPGF, getQuantile, getSD, getType, setDomain, setDomain
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ChiSquareDistribution

public ChiSquareDistribution(int n)
This general constructor creates a new chi-square distribuiton with a specified degrees of freedom parameter.

Parameters:
n - the degrees of freedom

ChiSquareDistribution

public ChiSquareDistribution()
This default constructor creates a new chi-square distribution with 1 degree of freedom.

Method Detail

setDegrees

public void setDegrees(int n)
This method sets the degrees of freedom parameter and computes the defaut domain.

Parameters:
n - the degrees of freedom

getDegrees

public int getDegrees()
This method returns the degrees of freedom parameter.

Returns:
the degrees of freedom

simulate

public double simulate()
This method simulates a value from the distribuiton, as the sum of squares of independent, standard normal distribution.

Overrides:
simulate in class GammaDistribution
Returns:
a simulated value form the distribution

setShape

public void setShape(double k)
This method sets the shape parameter, which must be n/2, where n is the degrees of freedom.

Overrides:
setShape in class GammaDistribution
Parameters:
k - the shape parameter

setScale

public void setScale(double b)
This method sets the scale parameter, which must be 2.

Overrides:
setScale in class GammaDistribution
Parameters:
b - the scale parameter

setParameters

public void setParameters(double k,
                          double b)
This method sets the gamma parameters, which must be related to the degrees of freedom.

Overrides:
setParameters in class GammaDistribution
Parameters:
k - the shape parameter
b - the scale parameter

toString

public java.lang.String toString()
This method returns a string that gives the name of the distribution and the values of the parameters.

Overrides:
toString in class GammaDistribution
Returns:
a string giving the name of the distribution and the values of the parameters