|
Infinity Engine v0.6.20
C++ API Documentation
|
Platform-independent chi-squared distribution. More...
#include <PRNGDistribution.hpp>
Classes | |
| struct | param_type |
| Parameter set for the distribution. More... | |
Public Types | |
| using | result_type = RealType |
| The type of values produced by the distribution. | |
Public Member Functions | |
| ChiSquaredDistribution () | |
| Default constructor. Creates ChiSquared(1) distribution. | |
| ChiSquaredDistribution (RealType n) | |
| Constructs a chi-squared distribution with specified degrees of freedom. | |
| ChiSquaredDistribution (const param_type ¶m) | |
| Constructs from a parameter set. | |
| void | reset () |
| Resets the distribution state. | |
| RealType | n () const |
| Gets the degrees of freedom. | |
| param_type | param () const |
| Gets the current parameter set. | |
| void | param (const param_type ¶m) |
| Sets new parameters for the distribution. | |
| result_type | min () const |
| Gets the minimum value that can be generated (approaches 0). | |
| result_type | max () const |
| Gets the theoretical maximum value (positive infinity). | |
| template<typename Generator > | |
| result_type | operator() (Generator &g) |
| Generates the next random value using stored parameters. | |
| template<typename Generator > | |
| result_type | operator() (Generator &g, const param_type ¶m) |
| Generates the next random value using provided parameters. | |
Friends | |
| bool | operator== (const ChiSquaredDistribution &lhs, const ChiSquaredDistribution &rhs) |
| bool | operator!= (const ChiSquaredDistribution &lhs, const ChiSquaredDistribution &rhs) |
Platform-independent chi-squared distribution.
Produces values according to the chi-squared distribution with n degrees of freedom. The chi-squared distribution is a special case of the gamma distribution: ChiSquared(n) = Gamma(n/2, 2).
This distribution is fundamental in statistics, appearing in hypothesis testing, confidence intervals, and goodness-of-fit tests. It represents the distribution of the sum of squares of n independent standard normal random variables.
| RealType | Floating point type (float or double) |
Example usage:
| using Infinity::Engine::ChiSquaredDistribution< RealType >::result_type = RealType |
The type of values produced by the distribution.
|
inline |
Default constructor. Creates ChiSquared(1) distribution.
|
inlineexplicit |
Constructs a chi-squared distribution with specified degrees of freedom.
| n | Degrees of freedom |
|
inlineexplicit |
Constructs from a parameter set.
| param | The distribution parameters |
|
inline |
Gets the theoretical maximum value (positive infinity).
|
inline |
Gets the minimum value that can be generated (approaches 0).
|
inline |
Gets the degrees of freedom.
|
inline |
Generates the next random value using stored parameters.
Uses the relationship ChiSquared(n) = Gamma(n/2, 2) by generating from the underlying gamma distribution.
| Generator | The random number generator type (e.g., PRNG) |
| g | The random number generator |
|
inline |
Generates the next random value using provided parameters.
Creates a temporary gamma distribution and generates a chi-squared value.
| Generator | The random number generator type (e.g., PRNG) |
| g | The random number generator |
| param | The distribution parameters to use for this generation |
|
inline |
Gets the current parameter set.
|
inline |
Sets new parameters for the distribution.
Recreates the underlying gamma distribution with the new degrees of freedom.
| param | The new distribution parameters |
|
inline |
Resets the distribution state.
Resets the underlying gamma distribution.
|
friend |
|
friend |