Class ChiSquaredDistribution
java.lang.Object
cloud.opencode.base.math.distribution.ChiSquaredDistribution
Immutable chi-squared distribution.
不可变卡方分布
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 TypeMethodDescriptiondoublecdf(double x) Computes the cumulative distribution function (CDF) at x.doubleReturns the degrees of freedom.doubleinverseCdf(double p) Computes the inverse CDF (quantile function).static ChiSquaredDistributionof(double degreesOfFreedom) Creates a chi-squared distribution with the specified degrees of freedom.doublepdf(double x) Computes the probability density function (PDF) at x.toString()
-
Method Details
-
of
Creates a chi-squared distribution with the specified degrees of freedom. 创建具有指定自由度的卡方分布- Parameters:
degreesOfFreedom- the degrees of freedom, must be > 0 / 自由度,必须 > 0- Returns:
- a new ChiSquaredDistribution instance / 新的卡方分布实例
- 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 处的概率密度函数值f(x) = x^(df/2-1) * exp(-x/2) / (2^(df/2) * Gamma(df/2))
- 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 处的累积分布函数值F(x) = P(df/2, x/2) where P is the regularized lower incomplete gamma function.
- 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
-