R.DGAMMA Function (Gnumeric)
Use Gnumeric R.DGAMMA for gamma density and log-density. Specify shape and scale correctly and check zero-cutoff and invalid-scale behavior.
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.DGAMMA(2,2,1) gives 0.270670566473 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.DGAMMA returns
R.DGAMMA returns a gamma probability density with a positive shape and a positive scale. Scale is the reciprocal of a rate parameter, not the rate itself. It controls the units of x; the density has reciprocal units and is not an accumulated probability. Versioned function help.
Syntax and arguments
=R.DGAMMA(x,shape,scale[,give_log])
- x: observation; ordinary density is zero for x<0.
- shape: required positive shape for the continuous gamma model.
- scale: required positive scale, in the same units as x.
- give_log: optional FALSE; TRUE returns natural log-density.
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.DGAMMA(2,2,1) |
0.270670566473 |
=R.DGAMMA(4,2,2) |
0.135335283237 |
=R.DGAMMA(1,1,2) |
0.303265329856 |
=R.DGAMMA(0,1,2) |
0.5 |
=R.DGAMMA(3,3,1) |
0.224041807655 |
=R.DGAMMA(2,.5,1) |
0.053990966513 |
=R.DGAMMA(2,2,1,TRUE()) |
-1.30685281944 |
=R.DGAMMA(4,2,2,TRUE()) |
-2 |
Practical worksheet
For shape=2 and scale=1, =R.DGAMMA(2,2,1) gives approximately 0.270670566473. Doubling both x and scale gives =R.DGAMMA(4,2,2), approximately 0.135335283237, half as large. A scale change stretches the horizontal axis and reduces density height accordingly.
For shape=1 and scale=2, the model is exponential with rate 1/2. At x=1, density is EXP(-1/2)/2, approximately 0.303265329856.
Advanced interpretation and checks
For x>0, density is x^(shape-1)*EXP(-x/scale)/(GAMMA(shape)*scale^shape). Its logarithm is (shape-1)*LN(x)-x/scale-GAMMALN(shape)-shape*LN(scale). The native log-density at x=4, shape=2, scale=2 is exactly −2 to the shown precision.
The advanced check multiplies the stretched density by 2 before comparing it with the original. For this gamma parameterization, mean=shape×scale and variance=shape×scale²; those describe the model, not the output of the density function.
The saved advanced-check result for =R.DGAMMA(4,2,2)*2-R.DGAMMA(2,2,1) was 0.
Boundaries and troubleshooting
At x=0, shape=1 gives 1/scale, shape>1 gives zero, and 0<shape<1 has an infinite limiting density and displays #NUM!. A negative x gives zero ordinary density but #NUM! in log mode because log(0)=−∞.
The source rejects nonpositive scale and negative shape. Shape=0 has a separate point-mass branch: positive x returned 0, while x=0 returned #NUM!. Do not substitute that branch for a positive-shape continuous model. Numeric-text and blank conversions are shown explicitly below.
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.DGAMMA(-1,2,1) |
0 |
=R.DGAMMA(-1,2,1,TRUE()) |
#NUM! |
=R.DGAMMA(0,.5,1) |
#NUM! |
=R.DGAMMA(0,2,1) |
0 |
=R.DGAMMA(1,0,1) |
0 |
=R.DGAMMA(0,0,1) |
#NUM! |
=R.DGAMMA(1,-1,1) |
#NUM! |
=R.DGAMMA(1,2,0) |
#NUM! |
=R.DGAMMA(1,2,-1) |
#NUM! |
=R.DGAMMA("1",2,1) |
0.367879441171 |
=R.DGAMMA("abc",2,1) |
#VALUE! |
=R.DGAMMA(F5,2,1) |
0 |
=R.DGAMMA(1,2) |
#N/A |
=R.DGAMMA(1,2,1,0,1) |
#N/A |
Official evidence and checking scope
- Current worksheet callback
- Tested-version worksheet callback
- Current dgamma calculation
- Tested-version dgamma 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.