pub struct StudentT { /* private fields */ }Expand description
Student’s t-distribution with a location and scale, StudentT(ν, μ, σ).
Heavy-tailed generalization of the Normal; as ν → ∞ it converges to
Normal(μ, σ). Widely used as a robust likelihood/prior because its tails
tolerate outliers. ν need not be an integer.
Mathematical Properties:
- Support: (-∞, +∞)
- PDF: f(x) = Γ((ν+1)/2) / (Γ(ν/2)·√(νπ)·σ) · (1 + z²/ν)^(-(ν+1)/2), where z = (x−μ)/σ
- Mean: μ for ν > 1 (undefined otherwise)
- Variance: σ²·ν/(ν−2) for ν > 2 (infinite for 1 < ν ≤ 2)
Example:
// Robust prior with 3 degrees of freedom.
let robust = sample(addr!("theta"), StudentT::new(3.0, 0.0, 1.0).unwrap());
// Robust likelihood tolerant of outliers.
let obs = observe(addr!("y"), StudentT::new(4.0, 1.0, 0.5).unwrap(), 2.0);Implementations§
Trait Implementations§
impl Copy for StudentT
Source§impl Distribution<f64> for StudentT
impl Distribution<f64> for StudentT
Source§fn sample(&self, rng: &mut dyn RngCore) -> f64
fn sample(&self, rng: &mut dyn RngCore) -> f64
Generate a random sample (with its natural type),
T, from the distribution, using the provided random number generator, rng. Read moreAuto Trait Implementations§
impl Freeze for StudentT
impl RefUnwindSafe for StudentT
impl Send for StudentT
impl Sync for StudentT
impl Unpin for StudentT
impl UnsafeUnpin for StudentT
impl UnwindSafe for StudentT
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more