R.QNBINOM Function (Gnumeric)
Find negative-binomial failure-count quantiles with Gnumeric R.QNBINOM. Check tail conventions, generalized shapes and degenerate-branch validation limits.
Verification status: 26 reference, boundary and advanced-check formulas were recalculated with Gnumeric 1.12.57 ssconvert. Saved identities, the blank input and numerical results were independently checked. Gnumeric 1.12.62 was source-checked only. How formula examples are checked
Validate the probability before using degenerate cases. In the tested build, size zero or success probability one can return zero before the helper checks an invalid requested probability. A numeric result is not proof that the input probability was valid.
Quick answer: =R.QNBINOM(.5,3,.5) gives 2 in Gnumeric 1.12.57.
Availability and version history
- Introduced: First release not established; present in the retained 1.12.57 source.
- Supported in: Gnumeric 1.12.62; no retirement is established.
- Scope: Desktop Gnumeric with its Statistical Functions From R plugin. English comma-separated formulas are shown.
- Checked: October 14, 2026. Tables and the named advanced check use 1.12.57 ssconvert. Current 1.12.62 source was inspected; that release was not executed.
What R.QNBINOM returns
R.QNBINOM returns a negative-binomial failure-count threshold. For ordinary positive size and 0<p<1, an interior lower-tail probability selects the smallest nonnegative integer k whose CDF reaches that probability. Integer size has the trials-until-success interpretation; positive noninteger size remains a mathematical shape. Versioned function help.
Syntax and arguments
=R.QNBINOM(probability,size,success_probability[,lower_tail[,log_p]])
- probability: required probability in [0,1], or its natural logarithm; validate it explicitly.
- size: required nonnegative shape; a positive integer describes the target number of successes. Positive noninteger shapes are supported mathematically.
- success_probability: per-trial success chance, with 0<p≤1.
- lower_tail: optional TRUE for a lower-tail probability; FALSE supplies the strict upper-tail probability.
- log_p: optional FALSE. TRUE means the input is a natural logarithm, such as LN(0.1), rather than 0.1.
Brackets mark optional arguments; do not type them. Current worksheet implementation.
Reproducible examples
These self-contained formulas were recalculated natively. Ordinary-domain results were checked against independent mathematics; source guards explain the boundary cases. Results are rounded to twelve decimal places, or thirteen significant digits for small nonzero values. This is presentation precision, not a universal accuracy guarantee.
| Formula | Gnumeric 1.12.57 result |
|---|---|
=R.QNBINOM(.5,3,.5) |
2 |
=R.QNBINOM(.9,3,.5) |
6 |
=R.QNBINOM(.1,3,.5,FALSE()) |
6 |
=R.QNBINOM(LN(.1),3,.5,FALSE(),TRUE()) |
6 |
=R.QNBINOM(.5,2.5,.4) |
3 |
=R.QNBINOM(0,3,.5) |
0 |
=R.QNBINOM(.5,0,.5) |
0 |
=R.QNBINOM(1,3,1) |
0 |
Practical worksheet
With size 3 and p=0.5, the 90% quantile is six failures. P(X≤5)=0.85546875 and P(X≤6)=0.91015625. Adding the three successes gives nine total trials for this threshold. The upper-tail 0.1 and log-upper-tail LN(0.1) examples identify the same count.
Advanced interpretation and checks
At size 1, negative-binomial and geometric count quantiles agree, as the saved difference check shows. Verify the quantile jump using R.PNBINOM(k−1,size,p)<a≤R.PNBINOM(k,size,p) for ordinary interior probabilities. The median in the size-3, p=0.5 example is two because its CDF already equals 0.5 there; a mean of three does not force the median to be three.
The saved advanced-check result for =R.QNBINOM(.9,1,.2)-R.QGEOM(.9,.2) was 0.
Boundaries and troubleshooting
For nondegenerate parameters, probability one is unbounded and becomes #NUM!. Degenerate size-zero or p=1 branches instead return zero. The boundary table also preserves zero for probability 1.1 in those branches and for the special size=0,p=0 combination. These out-of-contract observations must not be used as valid quantiles. Negative size and other invalid success probabilities are rejected; nonnumeric text and wrong arity fail separately.
F5 is genuinely empty, rather than a cell containing an empty string.
| Formula | Gnumeric 1.12.57 result |
|---|---|
=R.QNBINOM(1,3,.5) |
#NUM! |
=R.QNBINOM(0,3,.5,FALSE()) |
#NUM! |
=R.QNBINOM(1,3,.5,FALSE()) |
0 |
=R.QNBINOM(-.1,3,.5) |
#NUM! |
=R.QNBINOM(1.1,3,.5) |
#NUM! |
=R.QNBINOM(.5,-1,.5) |
#NUM! |
=R.QNBINOM(.5,3,0) |
#NUM! |
=R.QNBINOM(.5,3,1.1) |
#NUM! |
=R.QNBINOM(.5,0,0) |
0 |
=R.QNBINOM(1.1,0,.5) |
0 |
=R.QNBINOM(1.1,3,1) |
0 |
=R.QNBINOM(0,3,.5,TRUE(),TRUE()) |
#NUM! |
=R.QNBINOM(1,3,.5,TRUE(),TRUE()) |
#NUM! |
=R.QNBINOM("abc",3,.5) |
#VALUE! |
=R.QNBINOM(F5,3,.5) |
0 |
=R.QNBINOM(.5,3) |
#N/A |
=R.QNBINOM(.5,3,.5,1,0,1) |
#N/A |
Official evidence and checking scope
- Current worksheet callback
- Tested-version worksheet callback
- Current qnbinom calculation
- Tested-version qnbinom calculation
- Nonfinite worksheet-value handling
- Statistical Functions From R plugin declaration
- Quantile boundary convention
The relevant complete worksheet callback and main calculation helper are unchanged between the inspected versions. That does not establish later-version numerical execution. Both stale and uncached SUM controls recalculated correctly. Native XML preserves the R.* identities. The secondary ODF export keeps these calls in the ORG.GNUMERIC namespace; it does not establish execution in another product. GUI entry, other locales and other spreadsheet products were not tested.