# Forum: Ruby chi-square table

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
on 2007-07-01 16:31
```Hi all,

I need to build a chi-square table with 100 degree of freedom at
0.05,0.01, 0.001 level using Ruby. Does anyone out there know what the
formula is for this table ?

Thanks,

Li```
on 2007-07-01 16:54
```On 7/1/07, Li Chen <chen_li3@yahoo.com> wrote:
> --
> Posted via http://www.ruby-forum.com/.
>
>
The following may be useful to you:
http://en.wikipedia.org/wiki/Chi-square_distribution

on 2007-07-01 17:16
```G.Durga Prasad wrote:
> On 7/1/07, Li Chen <chen_li3@yahoo.com> wrote:
>> Hi all,
>>

http://en.wikipedia.org/wiki/Chi-square_distribution```
on 2007-07-01 17:46
```Dear Li,

if you're interested in the values rather than
in doing a programming exercise, you can use
the statistics2 package by Shin-ichi Hara:

--- Statistics2.chi2dist(n, x)
Returns the integral of Chi-squared distribution with n degrees of
freedom
over (-Infty, x].

--- Statistics2.pchi2dist(n, pr)
Returns the P-value of chi2dist().

--- Statistics2.chi2X_(n, x)
Returns the integral of Chi-squared distribution with n degrees of
freedom
over [0, x].

--- Statistics2.chi2_x(n, x)
Returns the integral of Chi-squared distribution with n degrees of
freedom
over [x, Infty).

--- Statistics2.pchi2X_(n, pr)
--- Statistics2.pchi2_x(n, pr)
Return the P-value of the corresponding integral.

Best regards,

Axel```
on 2007-07-01 18:40
```Hi Axel,

Thank you very much for the link. Currently I am more interested in
finding the critical value correponding to my chi-square value. But I
will try to figure out how to do it latter.

Li```
on 2007-07-01 21:12
```Dear Li,

> Currently I am more interested in
> finding the critical value correponding to my chi-square value.

Maybe a worked-through example like this one:

http://stattrek.com/AP-Statistics-4/Goodness-Of-Fi...

can clarify things further.

Best regards,

Axel```
This topic is locked and can not be replied to.