Contact

R.QHYPER Function (Gnumeric)

Statistical Intermediate Gnumeric Gnumeric 1.5.2

Find hypergeometric count thresholds with Gnumeric R.QHYPER. Validate integer populations, interpret tail probabilities and inspect bounded support endpoints.

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

Integer-population requirement: validate all three count inputs yourself. The tested quantile helper accepts some fractional counts and can return a fractional support endpoint, which is not a valid item-count quantile.

Quick answer: =R.QHYPER(.5,5,5,4) gives 2 in Gnumeric 1.12.57.

Availability and version history

  • Introduced: Introduced in Gnumeric 1.5.2 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.QHYPER returns

R.QHYPER selects a count threshold for draws without replacement from two categories. With valid integer population parameters and an interior lower-tail probability a, it finds the smallest supported count k whose CDF is at least a. Versioned function help.

Syntax and arguments

=R.QHYPER(probability,red_count,black_count,draws[,lower_tail[,log_p]])
  • probability: required probability from 0 through 1, or its natural logarithm.
  • 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 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.QHYPER(.5,5,5,4) 2
=R.QHYPER(.9,5,5,4) 3
=R.QHYPER(.1,5,5,4,FALSE()) 3
=R.QHYPER(LN(.1),5,5,4,FALSE(),TRUE()) 3
=R.QHYPER(0,8,2,4) 2
=R.QHYPER(1,8,2,4) 4
=R.QHYPER(.5,0,10,4) 0
=R.QHYPER(.5,0,0,0) 0

Practical worksheet

For four draws from five red and five black items, the 90% quantile is three red items. The CDF at two is 155/210, approximately 0.738095238095; at three it is 205/210, approximately 0.976190476190. Three is the first count reaching the requested coverage. It need not have CDF exactly 0.9.

Advanced interpretation and checks

The endpoints follow the finite support: max(0,draws−black_count) at lower-tail probability zero and min(draws,red_count) at probability one. With eight red, two black and four draws, these endpoints are two and four. Upper-tail probability 0.1 gives the same count as lower-tail 0.9; log mode uses LN(0.1). Zero draws from an empty population give count zero in the tested call.

The saved advanced-check result for =R.PHYPER(R.QHYPER(.9,5,5,4),5,5,4) was 0.97619047619.

Boundaries and troubleshooting

The helper checks raw counts for negative values and oversized draws, but does not require integral counts. Its downstream CDF rounds counts while its endpoint bounds use the raw values. Consequently, the two fractional-count probes below return 4.4 and 2.2. Those are preserved native observations, not valid hypergeometric quantiles. Use nonnegative integer counts and a valid probability before interpreting any returned number.

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

Formula Gnumeric 1.12.57 result
=R.QHYPER(-.1,5,5,4) #NUM!
=R.QHYPER(1.1,5,5,4) #NUM!
=R.QHYPER(.5,-1,5,4) #NUM!
=R.QHYPER(.5,5,-1,4) #NUM!
=R.QHYPER(.5,5,5,-1) #NUM!
=R.QHYPER(.5,5,5,11) #NUM!
=R.QHYPER(0,5,5,4,FALSE()) 4
=R.QHYPER(1,5,5,4,FALSE()) 0
=R.QHYPER(1,5.4,5.4,4.4) 4.4
=R.QHYPER(0,8.4,2.2,4.4) 2.2
=R.QHYPER(0,5,5,4,TRUE(),TRUE()) 4
=R.QHYPER(1,5,5,4,TRUE(),TRUE()) #NUM!
=R.QHYPER("abc",5,5,4) #VALUE!
=R.QHYPER(F5,5,5,4) 0
=R.QHYPER(.5,5,5) #N/A
=R.QHYPER(.5,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.