StudentT#
- class zfit.prior.StudentT(ndof, mu, sigma, name=None)[source]#
Bases:
BasePriorStudent’s t-distribution prior.
The Student’s t-distribution is a heavy-tailed distribution that approaches the normal distribution as degrees of freedom increase. It’s useful when you want robustness against outliers while maintaining finite variance (unlike the Cauchy distribution).
This prior is suitable for: - Robust inference with outlier resistance - Parameters where extreme values are possible but not as likely as in Cauchy - Alternative to Normal when heavier tails are desired - Location parameters with moderate uncertainty - Regression coefficients in robust modeling
Properties: - Support: All real numbers (-∞, ∞) - Mean = μ (for ndof > 1), undefined for ndof ≤ 1 - Variance = σ²·ndof/(ndof-2) (for ndof > 2) - Approaches Normal(mu, sigma) as ndof → ∞ - Heavier tails than normal for small ndof
Example
>>> # Heavy-tailed prior (like Cauchy but with finite variance) >>> prior = StudentT(ndof=3, mu=0.0, sigma=1.0) >>> >>> # Moderately robust prior >>> prior = StudentT(ndof=10, mu=5.0, sigma=2.0)
Initialize a Student’s t prior.
- Parameters:
- __eq__(other)#
Compare two priors for equality.
- Parameters:
other – Another ZfitPrior instance to compare with
- Returns:
True if the priors are equal
- Return type:
- __hash__()#
Return hash of the prior based on pdf and name.
- Returns:
Hash value for the prior
- Return type:
- log_pdf(value=None)#
Return the log probability of the prior at the given value(s).
- Parameters:
value – The parameter value(s) to evaluate the log probability at
- Returns:
The log probability
- sample(n)#
Sample n values from the prior distribution.
- Parameters:
n – Number of samples to draw
- Returns:
An array of samples