Manual calculation of p-value from chi square and df

178 Views Asked by At

I am trying to create an algorithm that could calculate the p-value given the chi-square statistic and the degrees of freedom. I found the following formula here

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.

1

There are 1 best solutions below

0
On BEST ANSWER

$$\int e^{-\frac t2}\, t^{\frac{d}{2}-1}\,dt=-2^{\frac{d}{2}}\, \Gamma \left(\frac{d}{2},\frac{t}{2}\right)$$

$$\int_{\chi^2}^\infty e^{-\frac t2}\, t^{\frac{d}{2}-1}\,dt=2^{\frac{d}{2}}\, \Gamma \left(\frac{d}{2},\frac{\chi^2}{2}\right)$$

$$Q_{\chi^2,d}=\frac{\Gamma \left(\frac{d}{2},\frac{\chi ^2}{2}\right)}{\Gamma \left(\frac{d}{2}\right)}$$ where appear the complete and incomplete gamma functions.