chi² and wolfram alpha

For the discussion of math. Duh.

Moderators: gmalivuk, Moderators General, Prelates

lorb
Posts: 405
Joined: Wed Nov 10, 2010 10:34 am UTC
Location: Austria

chi² and wolfram alpha

Postby lorb » Thu Apr 05, 2012 1:48 pm UTC

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.
Please be gracious in judging my english. (I am not a native speaker/writer.)
http://decodedarfur.org/

User avatar
NathanielJ
Posts: 882
Joined: Sun Jan 13, 2008 9:04 pm UTC

Re: chi² and wolfram alpha

Postby NathanielJ » Thu Apr 05, 2012 2:31 pm UTC

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).
Homepage: http://www.njohnston.ca
Conway's Game of Life: http://www.conwaylife.com

User avatar
Slpee
Posts: 69
Joined: Fri Jan 15, 2010 12:51 am UTC
Location: Cloud 9, just all the time.

Re: chi² and wolfram alpha

Postby Slpee » Thu Apr 05, 2012 4:11 pm UTC

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.
"Are you insinuating that a bunch of googly eyes hot-glued to a Cheeto constitutes a sapient being?"
Can't let you brew that Starbucks!


Image

User avatar
gmalivuk
GNU Terry Pratchett
Posts: 26414
Joined: Wed Feb 28, 2007 6:02 pm UTC
Location: Here and There
Contact:

Re: chi² and wolfram alpha

Postby gmalivuk » Thu Apr 05, 2012 6:32 pm UTC

Mathematica says it's 4.3e-40
Unless stated otherwise, I do not care whether a statement, by itself, constitutes a persuasive political argument. I care whether it's true.
---
If this post has math that doesn't work for you, use TeX the World for Firefox or Chrome

(he/him/his)

gorcee
Posts: 1501
Joined: Sun Jul 13, 2008 3:14 am UTC

Re: chi² and wolfram alpha

Postby gorcee » Thu Apr 05, 2012 6:55 pm UTC

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.

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

Re: chi² and wolfram alpha

Postby eta oin shrdlu » Thu Apr 05, 2012 11:20 pm UTC

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.
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]

User avatar
gmalivuk
GNU Terry Pratchett
Posts: 26414
Joined: Wed Feb 28, 2007 6:02 pm UTC
Location: Here and There
Contact:

Re: chi² and wolfram alpha

Postby gmalivuk » Fri Apr 06, 2012 12:41 am UTC

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.)
Unless stated otherwise, I do not care whether a statement, by itself, constitutes a persuasive political argument. I care whether it's true.
---
If this post has math that doesn't work for you, use TeX the World for Firefox or Chrome

(he/him/his)

clickclack
Posts: 4
Joined: Wed Mar 28, 2012 1:00 am UTC

Re: chi² and wolfram alpha

Postby clickclack » Fri Apr 06, 2012 1:59 am UTC

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.

User avatar
gmalivuk
GNU Terry Pratchett
Posts: 26414
Joined: Wed Feb 28, 2007 6:02 pm UTC
Location: Here and There
Contact:

Re: chi² and wolfram alpha

Postby gmalivuk » Fri Apr 06, 2012 2:04 am UTC

Well yeah, presumably Mathematica and Alpha use the same implementation of the same algorithm for most things, as they're both Wolfram products.
Unless stated otherwise, I do not care whether a statement, by itself, constitutes a persuasive political argument. I care whether it's true.
---
If this post has math that doesn't work for you, use TeX the World for Firefox or Chrome

(he/him/his)

lorb
Posts: 405
Joined: Wed Nov 10, 2010 10:34 am UTC
Location: Austria

Re: chi² and wolfram alpha

Postby lorb » Fri Apr 06, 2012 10:06 am UTC

Thank you all for your input.
You satisfied my curiosity quite well.
Please be gracious in judging my english. (I am not a native speaker/writer.)
http://decodedarfur.org/


Return to “Mathematics”

Who is online

Users browsing this forum: No registered users and 5 guests