Contact

R.PHYPER Function (Gnumeric)

Statistical Intermediate Gnumeric

Calculate hypergeometric cumulative probabilities in Gnumeric R.PHYPER. Check sampling support, strict upper tails and the release’s population rounding.

Verification status: 22 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

Count-input caution: the inspected helper rounds both population counts and the draw count before its domain checks. Enter deliberate integers; a fractional or small negative count can silently describe a different population.

Quick answer: =R.PHYPER(2,5,5,4) gives 0.738095238095 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.PHYPER returns

R.PHYPER returns the chance of observing at most a cutoff number of red items in sampling without replacement. FALSE lower_tail returns strictly more than that cutoff. Ordinary integer-population results sum the corresponding hypergeometric masses. Versioned function help.

Syntax and arguments

=R.PHYPER(cutoff,red_count,black_count,draws[,lower_tail[,log_p]])
  • cutoff: required red-item count threshold; ordinary fractional cutoffs are floored.
  • 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.
  • lower_tail: optional TRUE for P(X≤x); FALSE for the strict upper tail P(X>x).
  • log_p: optional FALSE. TRUE uses the natural logarithm of the probability.

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.PHYPER(2,5,5,4) 0.738095238095
=R.PHYPER(2.9,5,5,4) 0.738095238095
=R.PHYPER(2,5,5,4,FALSE()) 0.261904761905
=R.PHYPER(2,5,5,4,TRUE(),TRUE()) -0.303682413798
=R.PHYPER(2,5,5,4,FALSE(),TRUE()) -1.339774345485
=R.PHYPER(2,8,2,4) 0.133333333333
=R.PHYPER(0,0,10,4) 1
=R.PHYPER(12,50,450,100) 0.825498577171

Practical worksheet

Draw four items from five red and five black items. R.PHYPER(2,5,5,4)=155/210, approximately 0.738095238095. The upper-tail call is 55/210, approximately 0.261904761905, for three or four red items. A cutoff of 2.9 describes the same integer event as a cutoff of 2.

Advanced interpretation and checks

For at least two red items, use the strict upper tail at 1: R.PHYPER(1,5,5,4,FALSE())=155/210. For two through three red items, subtract the CDF at 1 from the CDF at 3, giving 150/210. With eight red and two black items and four draws, the minimum feasible count is two, so the lower tail at one is zero.

The saved advanced-check result for =R.PHYPER(2,5,5,4)+R.PHYPER(2,5,5,4,FALSE()) was 1.

Boundaries and troubleshooting

The tested (red,black,draws) values (3.6,5.4,4.4) are evaluated as (4,5,4). A red count of −0.4 rounds to zero and is accepted, whereas −0.6 becomes negative and errors. These source-derived coercions are not a reason to use fractional physical counts. After rounding, negative counts and oversized draws fail. Log-zero tails become #NUM!, while their ordinary probability remains zero.

F5 is genuinely empty, rather than a cell containing an empty string.

Formula Gnumeric 1.12.57 result
=R.PHYPER(-1,5,5,4) 0
=R.PHYPER(4,5,5,4) 1
=R.PHYPER(2,3.6,5.4,4.4) 0.833333333333
=R.PHYPER(0,-.4,10,4) 1
=R.PHYPER(0,-.6,10,4) #NUM!
=R.PHYPER(2,5,5,11) #NUM!
=R.PHYPER(1,8,2,4) 0
=R.PHYPER(1,8,2,4,TRUE(),TRUE()) #NUM!
=R.PHYPER(0,0,0,0) 1
=R.PHYPER("abc",5,5,4) #VALUE!
=R.PHYPER(F5,5,5,4) 0.02380952381
=R.PHYPER(2,5,5) #N/A
=R.PHYPER(2,5,5,4,1,0,1) #N/A

Official evidence and checking scope

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.