Class TDistribution

java.lang.Object
cloud.opencode.base.math.distribution.TDistribution

public final class TDistribution extends Object
Immutable Student's t-distribution. 不可变学生 t 分布

Provides PDF, CDF, and inverse CDF (quantile function). Thread-safe: instances are immutable.

提供概率密度函数、累积分布函数和逆累积分布函数(分位函数)。 线程安全:实例不可变。

Since:
JDK 25, opencode-base-math V1.0.3
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    cdf(double x)
    Computes the cumulative distribution function (CDF) at x.
    double
    Returns the degrees of freedom.
    double
    inverseCdf(double p)
    Computes the inverse CDF (quantile function).
    of(double degreesOfFreedom)
    Creates a t-distribution with the specified degrees of freedom.
    double
    pdf(double x)
    Computes the probability density function (PDF) at x.
     

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Method Details

    • of

      public static TDistribution of(double degreesOfFreedom)
      Creates a t-distribution with the specified degrees of freedom. 创建具有指定自由度的 t 分布
      Parameters:
      degreesOfFreedom - the degrees of freedom, must be > 0 / 自由度,必须 > 0
      Returns:
      a new TDistribution instance / 新的 t 分布实例
      Throws:
      IllegalArgumentException - if degreesOfFreedom ≤ 0 or is not finite
    • degreesOfFreedom

      public double degreesOfFreedom()
      Returns the degrees of freedom. 返回自由度
      Returns:
      the degrees of freedom / 自由度
    • pdf

      public double pdf(double x)
      Computes the probability density function (PDF) at x. 计算在 x 处的概率密度函数值
      Parameters:
      x - the point at which to evaluate the PDF / 计算 PDF 的点
      Returns:
      the density at x / x 处的密度值
    • cdf

      public double cdf(double x)
      Computes the cumulative distribution function (CDF) at x. 计算在 x 处的累积分布函数值

      Uses the regularized incomplete beta function: For x ≥ 0: cdf(x) = 1 - 0.5 * I(df/(df+x^2), df/2, 0.5) For x < 0: cdf(x) = 0.5 * I(df/(df+x^2), df/2, 0.5)

      Parameters:
      x - the point at which to evaluate the CDF / 计算 CDF 的点
      Returns:
      the cumulative probability P(X ≤ x) / 累积概率
    • inverseCdf

      public double inverseCdf(double p)
      Computes the inverse CDF (quantile function). 计算逆累积分布函数(分位函数)
      Parameters:
      p - the cumulative probability, must be in (0, 1) / 累积概率,必须在 (0, 1) 内
      Returns:
      the quantile x such that P(X ≤ x) = p / 使得 P(X ≤ x) = p 的分位数
      Throws:
      MathException - if p is not in (0, 1)
    • toString

      public String toString()
      Overrides:
      toString in class Object