R.QGAMMA Function (Gnumeric)
Find gamma quantiles with Gnumeric R.QGAMMA. Use lower or upper tails and log probability, and guard the tested zero or negative scale behavior.
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
Validate shape>0 and scale>0. In Gnumeric 1.12.57 the tested inverse returned zero for scale=0 and a negative cutoff for scale=−1. Those are not valid positive-scale gamma quantiles.
Quick answer: =R.QGAMMA(.5,2,1) gives 1.678346990017 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.QGAMMA returns
R.QGAMMA inverts a gamma probability to obtain a nonnegative cutoff for valid positive shape and scale. Its default probability is lower-tail; FALSE switches to an upper-tail probability. The function uses scale, not rate. Versioned function help.
Syntax and arguments
=R.QGAMMA(probability,shape,scale[,lower_tail[,log_p]])
- probability: 0–1 normally, or its natural logarithm with log_p=TRUE.
- shape: required and positive.
- scale: required and positive for a valid gamma distribution; validate it explicitly.
- lower_tail, log_p: optional TRUE and FALSE respectively. The output is a cutoff in scale units, not a logged cutoff.
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; invalid-model observations are identified separately below. 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.QGAMMA(.5,2,1) |
1.678346990017 |
=R.QGAMMA(.9,2,1) |
3.889720169867 |
=R.QGAMMA(.5,2,2) |
3.356693980033 |
=R.QGAMMA(.1,2,1,FALSE()) |
3.889720169867 |
=R.QGAMMA(LN(.1),2,1,FALSE(),TRUE()) |
3.889720169867 |
=R.QGAMMA(.5,1,2) |
1.38629436112 |
=R.QGAMMA(0,2,1) |
0 |
=R.QGAMMA(.75,3,1) |
3.920402060293 |
Practical worksheet
With shape=2 and scale=1, the median is approximately 1.678346990017 and the lower-tail 90th percentile is 3.889720169867. The 90th percentile is also the upper-tail 10th percentile.
Doubling scale to 2 doubles the median to approximately 3.356693980033. With shape=1 and scale=2, the median is 2×LN(2), approximately 1.386294361120.
Advanced interpretation and checks
=R.QGAMMA(LN(0.1),2,1,FALSE(),TRUE()) requests the upper-tail 10% cutoff using a logged input. It agrees with the ordinary upper-tail call. The saved inverse check sends the lower-tail 90th percentile to R.PGAMMA with the same parameters.
Quantiles scale linearly because the distribution is expressed in x/scale. That valid-model identity also explains the source defect: the implementation obtains a unit-scale cutoff and multiplies by scale without a positive-scale guard.
The saved advanced-check result for =R.PGAMMA(R.QGAMMA(.9,2,1),2,1) was 0.9.
Boundaries and troubleshooting
The tested negative-scale result was approximately −1.678346990017 for probability 0.5 and shape 2; scale=0 returned 0. These are observed invalid-model results. Reject nonpositive scale before calculation instead of trusting the presence of a number. Shape=0 and negative shape were rejected.
For a valid positive scale, lower-tail probability 0 gives cutoff 0; probability 1 has an infinite cutoff and displays #NUM!. Upper-tail endpoints reverse those roles. In log mode, input 0 means probability 1. Positive log-probabilities and ordinary probabilities outside [0,1] are invalid.
F5 is genuinely empty, rather than a cell containing an empty string. #NUM! can represent an unrepresentable infinite mathematical endpoint as well as an invalid numeric domain; the distinctions above matter.
| Formula | Gnumeric 1.12.57 result |
|---|---|
=R.QGAMMA(1,2,1) |
#NUM! |
=R.QGAMMA(0,2,1,FALSE()) |
#NUM! |
=R.QGAMMA(1,2,1,FALSE()) |
0 |
=R.QGAMMA(-.1,2,1) |
#NUM! |
=R.QGAMMA(1.1,2,1) |
#NUM! |
=R.QGAMMA(.5,0,1) |
#NUM! |
=R.QGAMMA(.5,-1,1) |
#NUM! |
=R.QGAMMA(.5,2,0) |
0 |
=R.QGAMMA(.5,2,-1) |
-1.678346990017 |
=R.QGAMMA(0,2,1,TRUE(),TRUE()) |
#NUM! |
=R.QGAMMA(1,2,1,TRUE(),TRUE()) |
#NUM! |
=R.QGAMMA("abc",2,1) |
#VALUE! |
=R.QGAMMA(F5,2,1) |
0 |
=R.QGAMMA(.5,2) |
#N/A |
=R.QGAMMA(.5,2,1,1,0,1) |
#N/A |
Official evidence and checking scope
- Current worksheet callback
- Tested-version worksheet callback
- Current qgamma calculation
- Tested-version qgamma calculation
- Nonfinite worksheet-value handling
- Statistical Functions From R plugin declaration
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 identities were checked; secondary ODF exports retain these functions with the ORG.GNUMERIC namespace. GUI entry, other locales and other spreadsheet products were not tested.