[R] chi2

(Ted Harding) Ted.Harding at manchester.ac.uk
Wed Oct 10 14:05:22 CEST 2007


On 10-Oct-07 10:59:43, elyakhlifi mustapha wrote:
> Hello,
> I want to use the quantile function so I read the doc but I don't
> understand with this
> 
>> qchisq(seq(0.05,0.95,by=0.05),df=(length(don)-1))
>  [1] 62667.11 62795.62 62882.42 62951.47 63010.74 63064.00 63113.39
> 63160.27 63205.65 63250.33 63295.04 63340.48 63387.48 63437.03 63490.53
> 63550.14 63619.68
> [18] 63707.24 63837.16
> 
> Can you help me please?

What that tells *me* is that 'don' is a quite long vector:
you should find that

length(don) = 63252 = 63251+1

as I verified using pchisq():

pchisq(62667.11,63251)
[1] 0.04999935

pchisq(63837.16,63251)
[1] 0.9499995

So 62667.11 is the value such that, with 63251 degrees of freedom,
Prob(chisq <= 62667.11) = 0.05
Prob(chisq <= 63837.16) = 0.95
(and similarly for the other values in your list).

The function qchisq() is simply the inverse of pchisq():
where pchisq(x,df) tells you Prob(chisq <= x) with df degrees
of freedom, for given x, qchisq(p,df) tells you what value
of x will give Prob(chisq <= x) = p for a given value of p.

Best wishes,
Ted.

--------------------------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 10-Oct-07                                       Time: 13:05:19
------------------------------ XFMail ------------------------------



More information about the R-help mailing list