I want to know the p-value for a given chi² value (209) with given degrees of freedom (9). How do i get wolfram alpha to tell me that? (or any other free tool)

And, yes this is homework, but my background is social sciences and my profs will be happy enough if i tell them i can reject the null-hypothesis with a probability to err of less than .1% (which i know is true because 209>27.88). i am just curious how small my p-value is exactly.

## chi² and wolfram alpha

**Moderators:** gmalivuk, Moderators General, Prelates

### chi² and wolfram alpha

Please be gracious in judging my english. (I am not a native speaker/writer.)

http://decodedarfur.org/

http://decodedarfur.org/

- NathanielJ
**Posts:**882**Joined:**Sun Jan 13, 2008 9:04 pm UTC

### Re: chi² and wolfram alpha

For most problems like this, you could use this tool. However, the p-value is so small it just spits out 0.

Heck, even MATLAB spits out 0 in this case, meaning that the probability is smaller than 10^-16 (and I would guess that it's actually in the ballpark of 10^-35).

Heck, even MATLAB spits out 0 in this case, meaning that the probability is smaller than 10^-16 (and I would guess that it's actually in the ballpark of 10^-35).

### Re: chi² and wolfram alpha

Actually, If you've ever worked with the TI-83/84/similar TI device, you can usually type in the same functions and arguments into wolfram alpha as you would in those devices, in your case it would be chi^2cdf(209,1e99,9) the 209 is the lower bound, 1e99 is an arbitrarily large number for the upper bound and 9 is your degrees of freedom (in case you aren't familiar with the TI arguments). Wolfram seems to understand all that when I enter it (http://www.wolframalpha.com/input/?i=chi%5E2cdf%28209%2C1e99%2C9%29) but it wont give me a p-value. I suspect this means its too small even for wolfram to bother finding it, so sorry mate, I don't know what to tell you.

- gmalivuk
- GNU Terry Pratchett
**Posts:**26542**Joined:**Wed Feb 28, 2007 6:02 pm UTC**Location:**Here and There-
**Contact:**

### Re: chi² and wolfram alpha

Mathematica says it's 4.3e-40

### Re: chi² and wolfram alpha

gmalivuk wrote:Mathematica says it's 4.3e-40

Just to add on this, I would be careful to cite such a number (obviously it's unnecessary to do so) because unless you have detailed knowledge of the specific algorithm used to compute the value, you cannot say for certain that the algorithm properly handles underflow.

For example, in many software routines, if you generate an nxn rank 1 matrix where the columns are all multiples of some nominal column, permutation of the order of those columns can lead to different results in, say, and SVD algorithm.

In general, be cautious with any result that gives you something under machine precision w/r.t. the input arguments. This doesn't imply that the answer is wrong, but before you rely on that number, you should be certain to ensure that underflow isn't corrupting those results.

- eta oin shrdlu
**Posts:**450**Joined:**Sat Jan 19, 2008 4:25 am UTC

### Re: chi² and wolfram alpha

Mathematica is usually pretty good about these things. At any rate, it's right in this case. One way to check this is to get bounds for the chi-squared PDF integral, which in this case is[math]\frac{1}{2^{9/2}\Gamma(4.5)}\int_X^\infty x^{7/2} e^{-x/2} \, dx[/math]with X=209. Four applications of integration by parts reduces the exponent of x in the integrand below 0:[math]=\frac{1}{2^{9/2}\Gamma(4.5)}\left[(2X^{7/2}+14X^{5/2}+70X^{3/2}+210X^{1/2})e^{-X/2}+105\int_X^\infty x^{-1/2}e^{-x/2}\,dx\right]\,.[/math]The boundary terms evaluate to 4.29E-40 as gmalivuk says; the remaining integral gives the error term, which can be bounded as[math]0<105\int_X^\infty x^{-1/2}e^{-x/2}\,dx<105X^{-1/2}\int_X^\infty e^{-x/2}\,dx=210X^{-1/2}e^{-X/2}=3.00\cdot10^{-45}\,.[/math]gorcee wrote:gmalivuk wrote:Mathematica says it's 4.3e-40

Just to add on this, I would be careful to cite such a number (obviously it's unnecessary to do so) because unless you have detailed knowledge of the specific algorithm used to compute the value, you cannot say for certain that the algorithm properly handles underflow.

- gmalivuk
- GNU Terry Pratchett
**Posts:**26542**Joined:**Wed Feb 28, 2007 6:02 pm UTC**Location:**Here and There-
**Contact:**

### Re: chi² and wolfram alpha

Yeah, the inputs were infinite-precision integers, in which case Mathematica usually gives a machine precision number at whatever accuracy is required. (Note that 10

^{-44}is a couple hundred orders of magnitude greater than the minimum machine number, which is where underflow happens.)-
**Posts:**4**Joined:**Wed Mar 28, 2012 1:00 am UTC

### Re: chi² and wolfram alpha

Entering "chi^2 distribution 9 degrees of freedom critical value 209" into wolfram alpha a closed form expression for the right tail-probability, as 1 - Q(9/2, 0, 209/2). Clicking that expression, it makes another query, and returns a numerical answer, 4.2868...e-40.

- gmalivuk
- GNU Terry Pratchett
**Posts:**26542**Joined:**Wed Feb 28, 2007 6:02 pm UTC**Location:**Here and There-
**Contact:**

### Re: chi² and wolfram alpha

Well yeah, presumably Mathematica and Alpha use the same implementation of the same algorithm for most things, as they're both Wolfram products.

### Re: chi² and wolfram alpha

Thank you all for your input.

You satisfied my curiosity quite well.

You satisfied my curiosity quite well.

Please be gracious in judging my english. (I am not a native speaker/writer.)

http://decodedarfur.org/

http://decodedarfur.org/

### Who is online

Users browsing this forum: No registered users and 4 guests