2022-07-07

I am trying to create an algorithm that could calculate the p-value given the chi-square statistic and the degrees of freedom. Can anyone please point me in the right direction on how I could go about to evaluate the formula and what prerequisites I need to learn before I could do it.

razdiralem

Expert

$\int {e}^{-\frac{t}{2}}\phantom{\rule{thinmathspace}{0ex}}{t}^{\frac{d}{2}-1}\phantom{\rule{thinmathspace}{0ex}}dt=-{2}^{\frac{d}{2}}\phantom{\rule{thinmathspace}{0ex}}\mathrm{\Gamma }\left(\frac{d}{2},\frac{t}{2}\right)$
${\int }_{{\chi }^{2}}^{\mathrm{\infty }}{e}^{-\frac{t}{2}}\phantom{\rule{thinmathspace}{0ex}}{t}^{\frac{d}{2}-1}\phantom{\rule{thinmathspace}{0ex}}dt={2}^{\frac{d}{2}}\phantom{\rule{thinmathspace}{0ex}}\mathrm{\Gamma }\left(\frac{d}{2},\frac{{\chi }^{2}}{2}\right)$
${Q}_{{\chi }^{2},d}=\frac{\mathrm{\Gamma }\left(\frac{d}{2},\frac{{\chi }^{2}}{2}\right)}{\mathrm{\Gamma }\left(\frac{d}{2}\right)}$
where appear the complete and incomplete gamma functions.

Do you have a similar question?