R.DHYPER Function (Gnumeric)
Calculate hypergeometric masses in Gnumeric R.DHYPER. Separate both population counts, sample without replacement and check exact support and log results.
Verification status: 24 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.DHYPER(2,5,5,4) gives 0.47619047619 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.DHYPER returns
R.DHYPER gives the chance of exactly x red items when drawing n items without replacement from r red and b black items. The mass is COMBIN(r,x)×COMBIN(b,n−x)/COMBIN(r+b,n). The population total is r+b; the second population argument is not that total. Versioned function help.
Syntax and arguments
=R.DHYPER(successes,red_count,black_count,draws[,give_log])
- successes: required integer count of red items observed.
- red_count, black_count: counts in the two categories, not a success count and a total population. Use nonnegative integers.
- draws: number selected without replacement, from 0 through red_count+black_count.
- give_log: optional FALSE; TRUE returns the 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.DHYPER(2,5,5,4) |
0.47619047619 |
=R.DHYPER(0,5,5,4) |
0.02380952381 |
=R.DHYPER(4,5,5,4) |
0.02380952381 |
=R.DHYPER(3,8,2,4) |
0.533333333333 |
=R.DHYPER(2,5,5,4,TRUE()) |
-0.741937344729 |
=R.DHYPER(0,0,10,4) |
1 |
=R.DHYPER(0,0,0,0) |
1 |
=R.DHYPER(12,50,450,100) |
0.1067505549 |
Practical worksheet
A container holds five red and five black items, and four are drawn without replacement. Exactly two red items has probability COMBIN(5,2)×COMBIN(5,2)/COMBIN(10,4)=100/210, approximately 0.476190476190. Sampling with replacement would instead use a binomial model with a constant success chance.
Advanced interpretation and checks
The feasible count range is max(0,n−b) through min(n,r). With eight red and two black items and four draws, at least two red items must appear. Exactly one red therefore has probability zero. For the five/five population and four draws, the masses have numerators 5, 50, 100, 50 and 5 over 210; they sum to one. The mean is n×r/(r+b)=2.
The saved advanced-check result for =R.DHYPER(2,5,5,4)-(R.PHYPER(2,5,5,4)-R.PHYPER(1,5,5,4)) was 0.
Boundaries and troubleshooting
Population counts and draws are checked for nonnegativity and near-integrality, and draws cannot exceed the population. Unlike R.PHYPER, genuinely fractional population values are rejected rather than rounded into another population. A fractional observed count such as 2.9 yields zero and a calculation warning. A zero mass in log mode becomes #NUM!; a zero-size draw has mass one at zero.
F5 is genuinely empty, rather than a cell containing an empty string.
| Formula | Gnumeric 1.12.57 result |
|---|---|
=R.DHYPER(-1,5,5,4) |
0 |
=R.DHYPER(2.9,5,5,4) |
0 |
=R.DHYPER(2,5.4,5,4) |
#NUM! |
=R.DHYPER(2,5,5.4,4) |
#NUM! |
=R.DHYPER(2,5,5,4.4) |
#NUM! |
=R.DHYPER(2,-1,5,4) |
#NUM! |
=R.DHYPER(2,5,5,11) |
#NUM! |
=R.DHYPER(1,8,2,4) |
0 |
=R.DHYPER(1,8,2,4,TRUE()) |
#NUM! |
=R.DHYPER(2,5.000000000000001,5,4) |
0.47619047619 |
=R.DHYPER("2",5,5,4) |
0.47619047619 |
=R.DHYPER("abc",5,5,4) |
#VALUE! |
=R.DHYPER(F5,5,5,4) |
0.02380952381 |
=R.DHYPER(2,5,5) |
#N/A |
=R.DHYPER(2,5,5,4,0,1) |
#N/A |
Official evidence and checking scope
- Current worksheet callback
- Tested-version worksheet callback
- Current dhyper calculation
- Tested-version dhyper 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.