Class BetaDistribution
java.lang.Object
cloud.opencode.base.math.distribution.BetaDistribution
Immutable Beta distribution.
不可变 Beta 分布
Provides PDF, CDF, inverse CDF (quantile function), mean, and variance. 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 TypeMethodDescriptiondoublealpha()Returns the alpha (first shape) parameter.doublebeta()Returns the beta (second shape) parameter.doublecdf(double x) Computes the cumulative distribution function (CDF) at x.doubleinverseCdf(double p) Computes the inverse CDF (quantile function).doublemean()Returns the mean of this distribution: alpha / (alpha + beta).static BetaDistributionof(double alpha, double beta) Creates a Beta distribution with the specified parameters.doublepdf(double x) Computes the probability density function (PDF) at x.toString()doublevariance()Returns the variance of this distribution: alpha*beta / ((alpha+beta)^2 * (alpha+beta+1)).
-
Method Details
-
of
Creates a Beta distribution with the specified parameters. 创建具有指定参数的 Beta 分布- Parameters:
alpha- the first shape parameter, must be > 0 / 第一形状参数,必须 > 0beta- the second shape parameter, must be > 0 / 第二形状参数,必须 > 0- Returns:
- a new BetaDistribution instance / 新的 Beta 分布实例
- Throws:
IllegalArgumentException- if alpha or beta ≤ 0 or not finite
-
alpha
public double alpha()Returns the alpha (first shape) parameter. 返回 alpha(第一形状)参数- Returns:
- the alpha parameter / alpha 参数
-
beta
public double beta()Returns the beta (second shape) parameter. 返回 beta(第二形状)参数- Returns:
- the beta parameter / beta 参数
-
mean
public double mean()Returns the mean of this distribution: alpha / (alpha + beta). 返回此分布的均值:alpha / (alpha + beta)- Returns:
- the mean / 均值
-
variance
public double variance()Returns the variance of this distribution: alpha*beta / ((alpha+beta)^2 * (alpha+beta+1)). 返回此分布的方差:alpha*beta / ((alpha+beta)^2 * (alpha+beta+1))- Returns:
- the variance / 方差
-
pdf
public double pdf(double x) Computes the probability density function (PDF) at x. 计算在 x 处的概率密度函数值f(x) = x^(alpha-1) * (1-x)^(beta-1) / B(alpha, beta)
- Parameters:
x- the point at which to evaluate the PDF, should be in [0, 1] / 计算 PDF 的点- Returns:
- the density at x / x 处的密度值
-
cdf
public double cdf(double x) Computes the cumulative distribution function (CDF) at x. 计算在 x 处的累积分布函数值F(x) = I_x(alpha, beta) where I is the regularized incomplete beta 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
-