R.DNBINOM Function (Gnumeric)
Calculate negative-binomial masses with Gnumeric R.DNBINOM. Count failures before successes, use noninteger shapes and verify zero-size and log boundaries.
Verification status: 23 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
Quick answer: =R.DNBINOM(0,3,.5) gives 0.125 in Gnumeric 1.12.57.
Availability and version history
- Introduced: First release not established; named in Gnumeric 1.12.10 release notes.
- 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.DNBINOM returns
R.DNBINOM returns a negative-binomial mass. For positive integer size r, it is the probability of x failures before the rth success in independent trials with success chance p. Its generalized mass is Γ(x+r)/(Γ(r)Γ(x+1))×p^r×(1−p)^x; positive noninteger r is a supported shape. Versioned function help.
Syntax and arguments
=R.DNBINOM(failures,size,success_probability[,give_log])
- failures: required nonnegative integer observation; it excludes the successes.
- 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.
- give_log: optional FALSE; TRUE returns a natural log mass.
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.DNBINOM(0,3,.5) |
0.125 |
=R.DNBINOM(2,3,.5) |
0.1875 |
=R.DNBINOM(4,2,.25) |
0.098876953125 |
=R.DNBINOM(2,2.5,.4) |
0.159378794072 |
=R.DNBINOM(2,3,.5,TRUE()) |
-1.673976433572 |
=R.DNBINOM(0,0,.5) |
1 |
=R.DNBINOM(0,3,1) |
1 |
=R.DNBINOM(1,3,1) |
0 |
Practical worksheet
With size 3 and success chance 0.5, exactly two failures before the third success has mass COMBIN(4,2)×0.5^3×0.5^2=0.1875. The terminating trial is a success, so the total trial count in that event is five. Replacing failures by total attempts would change the event.
Advanced interpretation and checks
Size 1 reduces to the geometric distribution. The stored subtraction check compares R.DNBINOM(3,1,0.2) with R.DGEOM(3,0.2); its tiny residual reflects floating-point evaluation rather than a mathematical disagreement. For size 3 and p=0.5, expected failures are r(1−p)/p=3 and variance is r(1−p)/p^2=6. The size=2.5 reference demonstrates a mathematical shape, not “two and a half observed successes.”
The saved advanced-check result for =R.DNBINOM(3,1,.2)-R.DGEOM(3,.2) was -1.387778780781E-17.
Boundaries and troubleshooting
Negative sizes and p outside 0<p≤1 are rejected. Size zero is handled as a point mass at zero in the tested ordinary cases; positive failures have mass zero. Fractional failure observations such as 2.9 return zero with a calculation warning rather than being floored. Logarithms of zero masses become #NUM!. Small near-integer differences use the explicit tolerance shown in the source.
F5 is genuinely empty, rather than a cell containing an empty string.
| Formula | Gnumeric 1.12.57 result |
|---|---|
=R.DNBINOM(2.9,3,.5) |
0 |
=R.DNBINOM(-1,3,.5) |
0 |
=R.DNBINOM(2,-1,.5) |
#NUM! |
=R.DNBINOM(2,3,0) |
#NUM! |
=R.DNBINOM(2,3,-.1) |
#NUM! |
=R.DNBINOM(2,3,1.1) |
#NUM! |
=R.DNBINOM(1,0,.5) |
0 |
=R.DNBINOM(1,0,.5,TRUE()) |
#NUM! |
=R.DNBINOM(2.000000000000001,3,.5) |
0.1875 |
=R.DNBINOM("2",3,.5) |
0.1875 |
=R.DNBINOM("abc",3,.5) |
#VALUE! |
=R.DNBINOM(F5,3,.5) |
0.125 |
=R.DNBINOM(2,3) |
#N/A |
=R.DNBINOM(2,3,.5,0,1) |
#N/A |
Official evidence and checking scope
- Current worksheet callback
- Tested-version worksheet callback
- Current dnbinom calculation
- Tested-version dnbinom calculation
- Nonfinite worksheet-value handling
- Statistical Functions From R plugin declaration
- Near-integer tolerance
- Noninteger mass check
The deliberate fractional count/trial probes also emitted noninteger-input calculation warnings. The saved logs retain them.
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.