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
| Language | Name in Excel |
|---|---|
| Arabic | CHISQ.DIST |
| Bulgarian | CHISQ.DIST |
| Czech | CHISQ.DIST |
| Danish | CHI2.FORDELING |
| German | CHISQ.DIST |
| Greek | CHISQ.DIST |
| English (Australia) | CHISQ.DIST |
| English (United Kingdom) | CHISQ.DIST |
| English (United States) | CHISQ.DIST |
| Spanish | DISTR.CHICUAD |
| Estonian | CHISQ.DIST |
| Finnish | CHINELIÖ.JAKAUMA |
| French | LOI.KHIDEUX.N |
| Hebrew | CHISQ.DIST |
| Croatian | CHISQ.DIST |
| Hungarian | KHINÉGYZET.ELOSZLÁS |
| Indonesian | CHISQ.DIST |
| Italian | CHISQ.DIST |
| Japanese | CHISQ.DIST |
| Korean | CHISQ.DIST |
| Lithuanian | CHISQ.DIST |
| Latvian | CHISQ.DIST |
| Norwegian | CHISQ.DIST |
| Dutch | CHIKW.VERD |
| Polish | ROZKŁ.CHI |
| Portuguese (Brazil) | CHISQ.DIST |
| Portuguese (Portugal) | DIST.CHIQ |
| Romanian | CHISQ.DIST |
| Russian | ХИ2.РАСП |
| Slovak | CHISQ.DIST |
| Slovenian | CHISQ.DIST |
| Serbian (Latin) | CHISQ.DIST |
| Swedish | CHI2.FÖRD |
| Thai | CHISQ.DIST |
| Turkish | KİKARE.DAĞ |
| Ukrainian | CHISQ.DIST |
| Vietnamese | CHISQ.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
=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 GitHub20 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 GitHubpub 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 GitHubpub 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
numscatalogue/distributionsvalidate_gamma_shapeported/beta_gamma_stats_familygamma_dist_kernelported/beta_gamma_stats_familytruncate_positive_integerported/chi_f_t_familyvalidate_nonnegative_xported/chi_f_t_familyfiniteported/discrete_distexpon_dist_kernelported/discrete_distbinary_withported/excel_numericexcel_expm1_internalported/excel_numericexcel_expm1_spilledported/excel_numericexpm1_internal_graphported/excel_numericexcel_x87_addported/excel_numericexcel_x87_subported/excel_numericexcel_x87_mulported/excel_numericexcel_x87_temme_finishported/excel_numericexcel_x87_divported/excel_numericmulported/excel_numeric/x87addported/excel_numeric/x87subported/excel_numeric/x87divported/excel_numeric/x87pow2_positiveported/excel_numeric/x87_chainspow2ported/excel_numeric/x87_chainsexp_extported/excel_numeric/x87_chainsexp_withported/excel_numeric/x87_chainsexcel_expported/excel_numeric/x87_chainslog_withported/excel_numeric/x87_chainsexcel_logported/excel_numeric/x87_chainsstored_hornerported/normal_dist_commonerf_approxported/normal_dist_commonerfc_upperported/normal_dist_commonerf_precise_kernelported/special_dist_familyln_gammaported/special_math_commongammaported/special_math_commongratio_norm_gammaported/special_math_commongratio_rexpported/special_math_commongratio_rlogported/special_math_commongratio_gam1ported/special_math_commongratioported/special_math_commonseries_prefactorported/special_math_commongratio_after40ported/special_math_commongratio_cfported/special_math_commongratio_temme_270ported/special_math_commongratio_temme_340ported/special_math_commongratio_temme_330ported/special_math_commongratio_temme_finishported/special_math_commonregularized_gamma_pported/special_math_common
Argument and result plumbing
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