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
df1Tensor | floatdf2Tensor | floatvalidate_argsbool | None= NoneTrue, validate parameter constraints at construction time.Attributes
df1Tensordf2TensorNotes
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.25Methods (5)
__init__
→None__init__(df1: Tensor | float, df2: Tensor | float, validate_args: bool | None = None)Initialise a Fisher-Snedecor F-distribution.
Parameters
df1Tensor | floatdf2Tensor | floatvalidate_argsbool | None= NoneTrue, validate parameter constraints at construction time.mean
→Tensormean: TensorMean of the F-distribution: .
Defined only for ; returns inf or nan otherwise.
Returns
TensorMean values of shape batch_shape.
variance
→Tensorvariance: TensorVariance of the F-distribution.
Defined only for .
Returns
TensorVariance values of shape batch_shape.
sample
→Tensorsample(sample_shape: tuple[int, ...] = ())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).
log_prob
→Tensorlog_prob(value: Tensor)Log-probability density of the F-distribution.
Parameters
valueTensorReturns
TensorLog-density values of the same shape as value.