Infinity Engine v0.6.20
C++ API Documentation
Loading...
Searching...
No Matches
Infinity::Engine::FisherFDistribution< RealType > Class Template Reference

Platform-independent Fisher F-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

 FisherFDistribution ()
 Default constructor. Creates F(1, 1) distribution.
 
 FisherFDistribution (RealType m, RealType n=RealType(1))
 Constructs an F-distribution with specified degrees of freedom.
 
 FisherFDistribution (const param_type &param)
 Constructs from a parameter set.
 
void reset ()
 Resets the distribution state.
 
RealType m () const
 Gets the numerator degrees of freedom.
 
RealType n () const
 Gets the denominator degrees of freedom.
 
param_type param () const
 Gets the current parameter set.
 
void param (const param_type &param)
 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 &param)
 Generates the next random value using provided parameters.
 

Friends

bool operator== (const FisherFDistribution &lhs, const FisherFDistribution &rhs)
 
bool operator!= (const FisherFDistribution &lhs, const FisherFDistribution &rhs)
 

Detailed Description

template<typename RealType = double>
class Infinity::Engine::FisherFDistribution< RealType >

Platform-independent Fisher F-distribution.

Produces values according to the F-distribution with m and n degrees of freedom. The F-distribution arises naturally when comparing two chi-squared distributions, making it essential for analysis of variance (ANOVA) and comparing variances.

If X ~ ChiSquared(m) and Y ~ ChiSquared(n), then F = (X/m)/(Y/n) ~ F(m, n). This distribution is fundamental in statistical hypothesis testing, particularly for testing equality of variances and in regression analysis.

Template Parameters
RealTypeFloating point type (float or double)

Example usage:

PRNG rng(12345);
// F-distribution with 5 and 10 degrees of freedom
FisherFDistribution<float> f_dist(5.0f, 10.0f);
float value = f_dist(rng);
// ANOVA test statistic simulation
FisherFDistribution<double> anova_stat(3.0, 20.0);
for (int i = 0; i < 1000; ++i) {
double f_value = anova_stat(rng);
}
Platform-independent Fisher F-distribution.
Definition PRNGDistribution.hpp:1525
Pseudo-random number generator for procedural generation.
Definition PRNG.hpp:48
Note
All values are strictly positive.
Mean = n/(n-2) for n > 2; undefined for n ≤ 2.
Variance = 2n²(m+n-2) / [m(n-2)²(n-4)] for n > 4.
As both m and n increase, the distribution becomes more symmetric.

Member Typedef Documentation

◆ result_type

template<typename RealType = double>
using Infinity::Engine::FisherFDistribution< RealType >::result_type = RealType

The type of values produced by the distribution.

Constructor & Destructor Documentation

◆ FisherFDistribution() [1/3]

template<typename RealType = double>
Infinity::Engine::FisherFDistribution< RealType >::FisherFDistribution ( )
inline

Default constructor. Creates F(1, 1) distribution.

◆ FisherFDistribution() [2/3]

template<typename RealType = double>
Infinity::Engine::FisherFDistribution< RealType >::FisherFDistribution ( RealType  m,
RealType  n = RealType(1) 
)
inlineexplicit

Constructs an F-distribution with specified degrees of freedom.

Parameters
mNumerator degrees of freedom
nDenominator degrees of freedom

◆ FisherFDistribution() [3/3]

template<typename RealType = double>
Infinity::Engine::FisherFDistribution< RealType >::FisherFDistribution ( const param_type param)
inlineexplicit

Constructs from a parameter set.

Parameters
paramThe distribution parameters

Member Function Documentation

◆ m()

template<typename RealType = double>
RealType Infinity::Engine::FisherFDistribution< RealType >::m ( ) const
inline

Gets the numerator degrees of freedom.

◆ max()

template<typename RealType = double>
result_type Infinity::Engine::FisherFDistribution< RealType >::max ( ) const
inline

Gets the theoretical maximum value (positive infinity).

◆ min()

template<typename RealType = double>
result_type Infinity::Engine::FisherFDistribution< RealType >::min ( ) const
inline

Gets the minimum value that can be generated (approaches 0).

◆ n()

template<typename RealType = double>
RealType Infinity::Engine::FisherFDistribution< RealType >::n ( ) const
inline

Gets the denominator degrees of freedom.

◆ operator()() [1/2]

template<typename RealType = double>
template<typename Generator >
result_type Infinity::Engine::FisherFDistribution< RealType >::operator() ( Generator &  g)
inline

Generates the next random value using stored parameters.

Generates two independent chi-squared variables and computes their ratio. Uses the relationship: F(m,n) = (ChiSquared(m)/m) / (ChiSquared(n)/n)

Template Parameters
GeneratorThe random number generator type (e.g., PRNG)
Parameters
gThe random number generator
Returns
A positive random value from the F-distribution

◆ operator()() [2/2]

template<typename RealType = double>
template<typename Generator >
result_type Infinity::Engine::FisherFDistribution< RealType >::operator() ( Generator &  g,
const param_type param 
)
inline

Generates the next random value using provided parameters.

Template Parameters
GeneratorThe random number generator type (e.g., PRNG)
Parameters
gThe random number generator
paramThe distribution parameters to use for this generation
Returns
A positive random value from F(param.m(), param.n())

◆ param() [1/2]

template<typename RealType = double>
param_type Infinity::Engine::FisherFDistribution< RealType >::param ( ) const
inline

Gets the current parameter set.

◆ param() [2/2]

template<typename RealType = double>
void Infinity::Engine::FisherFDistribution< RealType >::param ( const param_type param)
inline

Sets new parameters for the distribution.

Recreates both underlying gamma distributions with the new parameters.

Parameters
paramThe new distribution parameters

◆ reset()

template<typename RealType = double>
void Infinity::Engine::FisherFDistribution< RealType >::reset ( )
inline

Resets the distribution state.

Resets both underlying gamma distributions.

Friends And Related Symbol Documentation

◆ operator!=

template<typename RealType = double>
bool operator!= ( const FisherFDistribution< RealType > &  lhs,
const FisherFDistribution< RealType > &  rhs 
)
friend

◆ operator==

template<typename RealType = double>
bool operator== ( const FisherFDistribution< RealType > &  lhs,
const FisherFDistribution< RealType > &  rhs 
)
friend