Statistical functions

CHISQ.DIST

Matches all 5 recorded answers

Recorded: 5 workbook cells. How we measure this · See the Rust code

Local names in 40 languages
LanguageName in Excel
ArabicCHISQ.DIST
BulgarianCHISQ.DIST
CzechCHISQ.DIST
DanishCHI2.FORDELING
GermanCHISQ.DIST
GreekCHISQ.DIST
English (Australia)CHISQ.DIST
English (United Kingdom)CHISQ.DIST
English (United States)CHISQ.DIST
SpanishDISTR.CHICUAD
EstonianCHISQ.DIST
FinnishCHINELIÖ.JAKAUMA
FrenchLOI.KHIDEUX.N
HebrewCHISQ.DIST
CroatianCHISQ.DIST
HungarianKHINÉGYZET.ELOSZLÁS
IndonesianCHISQ.DIST
ItalianCHISQ.DIST
JapaneseCHISQ.DIST
KoreanCHISQ.DIST
LithuanianCHISQ.DIST
LatvianCHISQ.DIST
NorwegianCHISQ.DIST
DutchCHIKW.VERD
PolishROZKŁ.CHI
Portuguese (Brazil)CHISQ.DIST
Portuguese (Portugal)DIST.CHIQ
RomanianCHISQ.DIST
RussianХИ2.РАСП
SlovakCHISQ.DIST
SlovenianCHISQ.DIST
Serbian (Latin)CHISQ.DIST
SwedishCHI2.FÖRD
ThaiCHISQ.DIST
TurkishKİKARE.DAĞ
UkrainianCHISQ.DIST
VietnameseCHISQ.DIST
Chinese (Simplified)CHISQ.DIST
Chinese (Hong Kong)CHISQ.DIST
Chinese (Traditional)CHISQ.DIST

Names from Microsoft's support site.

What it does

CHISQ.DIST(x, deg_freedom, cumulative)

CHISQ.DIST(x, deg_freedom, cumulative) returns a chi-square CDF when cumulative is TRUE, or its density when FALSE.

Try it

Input cells (optional)

Example: {"B2": 3, "B3": 4}. A1 holds the formula. Other cells need values before a formula can read them.

Enter a formula, then calculate.

Runs locally in your browser with OneCalc. Its answer may differ from Excel. Use English function names and commas between arguments.

=CHISQ.DIST(2,2,TRUE) is about 0.632120558828558. At two degrees of freedom the right tail is exp(-x/2). The CDF is its mathematical complement, while density at x=2 is about 0.183939720585721.

Quirks

Degrees of freedom are truncated. Negative x and an admitted degree count below one or above 10^10 give #NUM! in the current shared family. Nonnumeric arguments give #VALUE!. A density is not the probability of the exact input value; use a CDF difference for an interval.

How to implement

For the cumulative branch the current kernel calls the gamma CDF at shape df/2, scale two. Its df=1 route is ERF.PRECISE of sqrt(x/2); its df=2 route uses the exponential CDF. For a density at positive x the mathematical expression is x^(df/2-1)*exp(-x/2)/(2^(df/2)*Gamma(df/2)); handle x=0 limits explicitly. The worked df=2 value follows from x/2=1. The numerical outline is an implementation route, not an identification of every Excel approximation or return-rounding stage. The current problem-functions report retains unresolved distribution mismatches.

Rust code

Show the CalcFunc source of this function

Quoted from the public repository DnaCalc/DnaCalc, crates calc-func and calc-fml, at commit 9e1884369a67. Comments are the source's own. A kernel shared with other functions appears once, on its module page.

CHISQ.DIST · 4 lines · calc-func/src/catalogue/distributions.rs on GitHub
20 chisq_dist "CHISQ.DIST" (3, 3) [V "x", V "deg_freedom", V "cumulative"] |s, a, sv| {
    let [x, df] = nums::<2>(s, a)?;
    out(s, cft::chisq_dist_kernel(x, df, flag(s, a, 2)?))
}
chisq_pdf_kernel · 16 lines · calc-func/src/ported/chi_f_t_family.rs on GitHub
pub fn chisq_pdf_kernel(x: f64, deg_freedom: f64) -> Result<f64, WorksheetErrorCode> {
    let x = validate_nonnegative_x(x)?;
    let k = truncate_positive_integer(deg_freedom)?;
    if x == 0.0 {
        return if k == 1.0 {
            // CDF limit is finite but density diverges to +inf; Excel returns #NUM!
            Err(WorksheetErrorCode::Num)
        } else if k == 2.0 {
            Ok(0.5)
        } else {
            Ok(0.0)
        };
    }
    let half_k = k / 2.0;
    Ok(crt_pow(x, half_k - 1.0) * crt_exp(-x / 2.0) / (crt_pow(2.0_f64, half_k) * gamma(half_k)))
}
chisq_dist_kernel · 28 lines · calc-func/src/ported/chi_f_t_family.rs on GitHub
pub fn chisq_dist_kernel(
    x: f64,
    deg_freedom: f64,
    cumulative: bool,
) -> Result<f64, WorksheetErrorCode> {
    let x = validate_nonnegative_x(x)?;
    let k = truncate_positive_integer(deg_freedom)?;
    if cumulative {
        // Inverse-problem identity, live Excel 16.0 b20228: CHISQ.DIST(x,1,TRUE)
        // == ERF.PRECISE(SQRT(x/2)) == GAMMA.DIST(x,0.5,2,TRUE) on 154/154
        // distinct x. Rival stagings SQRT(x)/SQRT(2) and SQRT(x)*(1/SQRT(2))
        // fail the same bank.
        // Inverse-problem identity, live Excel 16.0 b20228:
        // CHISQ.DIST(x,df,TRUE) == GAMMA.DIST(x, df/2, 2, TRUE) on 88/88
        // across df in {1,2,3,4,5,6,8,10}. 1-CHIDIST is not the CDF (49/88).
        // Routes df=1/2 through the landed ERF/EXPON gamma specials.
        crate::ported::beta_gamma_stats_family::gamma_dist_kernel(x, k / 2.0, 2.0, true).map_err(
            |e| match e {
                code => {
                    code
                }
                _ => WorksheetErrorCode::Value,
            },
        )
    } else {
        chisq_pdf_kernel(x, k)
    }
}

Kernels shared with other functions

Argument and result plumbing

  • flag catalogue/kit
  • num catalogue/kit
  • out catalogue/kit

No implementation has been published with a Handbook test suite for this function.

Version differences

No same-input comparison between named Excel builds is recorded for this function here. The documented behaviour below is not a measurement of every Excel release.

Alternatives

CHISQ.INV inverts the corresponding probability. CHISQ.TEST computes a test probability from observed and expected counts.

Named variants

No named variants are recorded yet.

Suggest a correction or contribute an implementation · For agents