Contact

R.DCHISQ Function (Gnumeric)

Statistical Intermediate Gnumeric

Calculate chi-square density and log-density with Gnumeric R.DCHISQ. See fractional degrees of freedom, the zero boundary and gamma equivalence.

Verification status: 21 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.DCHISQ(0,2) gives 0.5 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.DCHISQ returns

R.DCHISQ returns chi-square density with the specified degrees of freedom. It is a density height, not a right-tail test probability. The helper is a gamma density with shape=degrees_freedom/2 and scale=2. Versioned function help.

Syntax and arguments

=R.DCHISQ(x,degrees_freedom[,give_log])
  • x: observation; ordinary density is zero below zero.
  • degrees_freedom: required positive real number. This implementation does not round it to an integer.
  • give_log: optional FALSE; TRUE returns the natural logarithm of the 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.DCHISQ(0,2) 0.5
=R.DCHISQ(2,2) 0.183939720586
=R.DCHISQ(4,4) 0.135335283237
=R.DCHISQ(6,6) 0.112020903828
=R.DCHISQ(2,1) 0.103776874355
=R.DCHISQ(2,2.5) 0.202933823817
=R.DCHISQ(2,2,TRUE()) -1.69314718056
=R.DCHISQ(4,4,TRUE()) -2

Practical worksheet

At x=2 with 2 degrees of freedom, =R.DCHISQ(2,2) gives approximately 0.183939720586. This is EXP(-1)/2, not the chi-square upper-tail probability.

At x=4 with 4 degrees of freedom, density is approximately 0.135335283237. The 2.5-degree example is intentional: its density at x=2 is approximately 0.202933823817, showing that fractional degrees of freedom are retained.

Advanced interpretation and checks

For ν>0 and x>0, density is x^(ν/2-1)*EXP(-x/2)/(2^(ν/2)*GAMMA(ν/2)). The log form avoids constructing and then logging each factor. At x=4, ν=4, log-density is −2.

The saved advanced check compares R.DCHISQ(4,4) with R.DGAMMA(4,2,2). This equivalence fixes both gamma parameters and provides a useful check when translating between models.

The saved advanced-check result for =R.DCHISQ(4,4)-R.DGAMMA(4,2,2) was 0.

Boundaries and troubleshooting

At x=0 the limiting density is infinite for 0<ν<2, equals 0.5 for ν=2, and is zero for ν>2. The infinite result appears as #NUM!, while a zero density in log mode also produces #NUM!. These have different mathematical reasons.

The tested ν=0 branch returned zero at positive x and #NUM! at zero; it is a gamma limit branch, not an ordinary positive-degree chi-square model. Use ν>0. Negative degrees were rejected. For a right-tail probability, use a cumulative function with the appropriate tail, not this density.

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.DCHISQ(-1,2) 0
=R.DCHISQ(-1,2,TRUE()) #NUM!
=R.DCHISQ(0,1) #NUM!
=R.DCHISQ(0,4) 0
=R.DCHISQ(1,0) 0
=R.DCHISQ(0,0) #NUM!
=R.DCHISQ(1,-1) #NUM!
=R.DCHISQ("1",2) 0.303265329856
=R.DCHISQ("abc",2) #VALUE!
=R.DCHISQ(F5,2) 0.5
=R.DCHISQ(1) #N/A
=R.DCHISQ(1,2,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. Secondary ODF export maps two-argument R.DCHISQ to CHISQDIST with FALSE, R.PCHISQ to CHISQDIST, and R.QCHISQ to CHISQINV; additional arguments retain ORG.GNUMERIC names. These storage mappings do not establish execution in another product. GUI entry, other locales and other spreadsheet products were not tested.