gov.sandia.cognition.statistics.distribution

## Class ChiSquareDistribution

• ### Nested Class Summary

Nested Classes
Modifier and Type Class and Description
`static class ` `ChiSquareDistribution.CDF`
Cumulative Distribution Function (CDF) of a Chi-Square Distribution
`static class ` `ChiSquareDistribution.PDF`
PDF of the Chi-Square distribution
• ### Field Summary

Fields
Modifier and Type Field and Description
`static double` `DEFAULT_DEGREES_OF_FREEDOM`
Default degrees of freedom, 2.0.
• ### Constructor Summary

Constructors
Constructor and Description
`ChiSquareDistribution()`
Default constructor.
`ChiSquareDistribution(ChiSquareDistribution other)`
Copy constructor
`ChiSquareDistribution(double degreesOfFreedom)`
Creates a new instance of ChiSquareDistribution
• ### Method Summary

All Methods
Modifier and Type Method and Description
`ChiSquareDistribution` `clone()`
This makes public the clone method on the `Object` class and removes the exception that it throws.
`void` `convertFromVector(Vector parameters)`
Sets the parameter of the chi-square PDF
`Vector` `convertToVector()`
Returns the parameter of the chi-square PDF
`ChiSquareDistribution.CDF` `getCDF()`
Gets the CDF of a scalar distribution.
`double` `getDegreesOfFreedom()`
Getter for degrees of freedom
`java.lang.Double` `getMaxSupport()`
Gets the minimum support (domain or input) of the distribution.
`double` `getMeanAsDouble()`
Gets the mean of the distribution as a double.
`java.lang.Double` `getMinSupport()`
Gets the minimum support (domain or input) of the distribution.
`ChiSquareDistribution.PDF` `getProbabilityFunction()`
Gets the distribution function associated with this Distribution, either the PDF or PMF.
`double` `getVariance()`
Gets the variance of the distribution.
`static java.util.ArrayList<java.lang.Double>` ```sample(double degreesOfFreedom, java.util.Random random, int numSamples)```
Samples from a Chi-Square distribution with the given degrees of freedom
`static double[]` ```sampleAsDoubles(double degreesOfFreedom, java.util.Random random, int numSamples)```
Samples from a Chi-Square distribution with the given degrees of freedom
`void` ```sampleInto(java.util.Random random, double[] output, int start, int length)```
Samples values from this distribution as an array of doubles.
`void` `setDegreesOfFreedom(double degreesOfFreedom)`
Setter for degrees of freedom
• ### Methods inherited from class gov.sandia.cognition.statistics.AbstractClosedFormSmoothUnivariateDistribution

`getMean, sampleAsDouble, sampleAsDoubles, sampleInto`
• ### Methods inherited from class gov.sandia.cognition.statistics.AbstractDistribution

`sample, sample`
• ### Methods inherited from class java.lang.Object

`equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• ### Methods inherited from interface gov.sandia.cognition.statistics.Distribution

`sample, sample`
• ### Field Detail

• #### DEFAULT_DEGREES_OF_FREEDOM

`public static final double DEFAULT_DEGREES_OF_FREEDOM`
Default degrees of freedom, 2.0.
Constant Field Values
• ### Constructor Detail

• #### ChiSquareDistribution

`public ChiSquareDistribution()`
Default constructor.
• #### ChiSquareDistribution

`public ChiSquareDistribution(double degreesOfFreedom)`
Creates a new instance of ChiSquareDistribution
Parameters:
`degreesOfFreedom` - Number of degrees of freedom in the distribution, must be greater than 0.0
• #### ChiSquareDistribution

`public ChiSquareDistribution(ChiSquareDistribution other)`
Copy constructor
Parameters:
`other` - ChiSquareDistribution to copy
• ### Method Detail

• #### clone

`public ChiSquareDistribution clone()`
Description copied from class: `AbstractCloneableSerializable`
This makes public the clone method on the `Object` class and removes the exception that it throws. Its default behavior is to automatically create a clone of the exact type of object that the clone is called on and to copy all primitives but to keep all references, which means it is a shallow copy. Extensions of this class may want to override this method (but call `super.clone()` to implement a "smart copy". That is, to target the most common use case for creating a copy of the object. Because of the default behavior being a shallow copy, extending classes only need to handle fields that need to have a deeper copy (or those that need to be reset). Some of the methods in `ObjectUtil` may be helpful in implementing a custom clone method. Note: The contract of this method is that you must use `super.clone()` as the basis for your implementation.
Specified by:
`clone` in interface `Vectorizable`
Specified by:
`clone` in interface `CloneableSerializable`
Overrides:
`clone` in class `AbstractClosedFormUnivariateDistribution<java.lang.Double>`
Returns:
A clone of this object.
• #### getDegreesOfFreedom

`public double getDegreesOfFreedom()`
Getter for degrees of freedom
Returns:
Number of degrees of freedom in the distribution, must be greater than 0.0
• #### setDegreesOfFreedom

`public void setDegreesOfFreedom(double degreesOfFreedom)`
Setter for degrees of freedom
Parameters:
`degreesOfFreedom` - Number of degrees of freedom in the distribution, must be greater than 0.0
• #### getMeanAsDouble

`public double getMeanAsDouble()`
Description copied from interface: `UnivariateDistribution`
Gets the mean of the distribution as a double.
Returns:
The mean as a double.
• #### getVariance

`public double getVariance()`
Description copied from interface: `UnivariateDistribution`
Gets the variance of the distribution. This is sometimes called the second central moment by more pedantic people, which is equivalent to the square of the standard deviation.
Returns:
Variance of the distribution.
• #### convertToVector

`public Vector convertToVector()`
Returns the parameter of the chi-square PDF
Returns:
1-dimensional Vector containing the degrees of freedom
• #### convertFromVector

`public void convertFromVector(Vector parameters)`
Sets the parameter of the chi-square PDF
Parameters:
`parameters` - 1-dimensional Vector containing the degrees of freedom
• #### sampleInto

```public void sampleInto(java.util.Random random,
double[] output,
int start,
int length)```
Description copied from interface: `SmoothUnivariateDistribution`
Samples values from this distribution as an array of doubles. This is a convenience method to potentially avoid boxing.
Parameters:
`random` - Random number generator to use.
`output` - The array to write the result into. Cannot be null.
`start` - The offset in the array to start writing at. Cannot be negative.
`length` - The number of values to sample. Cannot be negative.
• #### sampleAsDoubles

```public static double[] sampleAsDoubles(double degreesOfFreedom,
java.util.Random random,
int numSamples)```
Samples from a Chi-Square distribution with the given degrees of freedom
Parameters:
`degreesOfFreedom` - Degrees of freedom of the Chi-Square distribution
`random` - Random number generator
`numSamples` - Number of samples to generate
Returns:
Samples from the GammaDistribution using the Chi-Square DOFs.
• #### sample

```public static java.util.ArrayList<java.lang.Double> sample(double degreesOfFreedom,
java.util.Random random,
int numSamples)```
Samples from a Chi-Square distribution with the given degrees of freedom
Parameters:
`degreesOfFreedom` - Degrees of freedom of the Chi-Square distribution
`random` - Random number generator
`numSamples` - Number of samples to generate
Returns:
Samples from the GammaDistribution using the Chi-Square DOFs.
• #### getCDF

`public ChiSquareDistribution.CDF getCDF()`
Description copied from interface: `UnivariateDistribution`
Gets the CDF of a scalar distribution.
Returns:
CDF of the scalar distribution.
• #### getProbabilityFunction

`public ChiSquareDistribution.PDF getProbabilityFunction()`
Description copied from interface: `ComputableDistribution`
Gets the distribution function associated with this Distribution, either the PDF or PMF.
Returns:
Distribution function associated with this Distribution.
• #### getMinSupport

`public java.lang.Double getMinSupport()`
Description copied from interface: `UnivariateDistribution`
Gets the minimum support (domain or input) of the distribution.
Returns:
Minimum support.
• #### getMaxSupport

`public java.lang.Double getMaxSupport()`
Description copied from interface: `UnivariateDistribution`
Gets the minimum support (domain or input) of the distribution.
Returns:
Minimum support.