FisherSnedecor
DistributionFisherSnedecor(df1: Tensor | float, df2: Tensor | float, validate_args: bool | None = None)Fisher-Snedecor F-distribution — ratio of two scaled Chi-squared variates.
FisherSnedecor(df1=d1, df2=d2) is the distribution of the statistic
where and are independent. The F-distribution is foundational in classical statistics: it arises in ANOVA F-tests and in the likelihood-ratio test for comparing nested linear models.
Parameters
Attributes
Notes
PDF:
Log-PDF (stable form using lgamma):
Moments (when defined):
- Mean ():
- Variance ():
Sampling draws one and one sample and forms the ratio. Both samples are drawn via the Gamma sampler.
Examples
>>> import lucid
>>> from lucid.distributions import FisherSnedecor
>>> dist = FisherSnedecor(df1=5.0, df2=10.0)
>>> samples = dist.sample((100,))
>>> dist.mean # d2/(d2-2) = 10/8 = 1.25
tensor(1.25)Used by 1
Constructors
1__init__
→None__init__(df1: Tensor | float, df2: Tensor | float, validate_args: bool | None = None)Properties
3Mean of the F-distribution: .
Defined only for ; returns inf or nan otherwise.
Returns
TensorMean values of shape batch_shape.
Mode of the F-distribution.
nan for , where the density is unbounded at 0,
as the reference framework answers.
Variance of the F-distribution.
Defined only for .
Returns
TensorVariance values of shape batch_shape.
Instance methods
2Log-probability density of the F-distribution.
The power of is kept as one term so that at
it is 0 even at , where the density
is the finite ; written as
it was
-inf - (-inf) = NaN for every .
Parameters
valueTensorReturns
TensorLog-density values of the same shape as value.
Draw samples from the F-distribution.
Forms the ratio where and are independent samples drawn via the Gamma sampler.
Parameters
sample_shapetuple[int, ...]= ()Returns
TensorPositive samples of shape (*sample_shape, *batch_shape).