Computes the \(p\)-th quantile of \(K_J \mid \alpha\), defined as the smallest \(k\) such that \(P(K_J \leq k \mid \alpha) \geq p\).
Details
For \(p = 0.5\), this gives the median. Note that for discrete distributions, the quantile is defined as the smallest value where the CDF meets or exceeds \(p\).
Edge cases:
\(p = 0\): returns 0 (the first k where CDF >= 0)
\(p = 1\): returns J (the maximum possible K)
Examples
logS <- compute_log_stirling(50)
# Single quantile (median)
quantile_K_given_alpha(0.5, 50, 2.0, logS)
#> [1] 7
# Multiple quantiles
quantile_K_given_alpha(c(0.25, 0.5, 0.75), 50, 2.0, logS)
#> [1] 6 7 8
# Edge cases
quantile_K_given_alpha(0, 50, 2.0, logS) # Returns 0
#> [1] 0
quantile_K_given_alpha(1, 50, 2.0, logS) # Returns 50
#> [1] 50