Duncan Murdoch
2009-May-11 16:48 UTC
[R] anyone know how to calculate chi square value from P value?
On 5/11/2009 3:36 PM, Anyuan Guo wrote:> Dear all, > I have P value of a list of markers. Now I need the chi square value > with degrees of freedom 2. > I noticed there are several Chisquare functions (dchisq, pchisq, > qchisq, and rchisq), but it seems all are not for my purpose. > In microsoft excel, there is a function CHINV to do this, such as > CHINV(0.184, 2) is 3.386, that means the chi square value for P value > 0.184, degree 2 is 3.386. > Does the R package has some function to do this?qchisq(0.184, df=2, lower=FALSE) Duncan Murdoch
R. A. Bilonick
2009-May-11 17:07 UTC
[R] anyone know how to calculate chi square value from P value?
On Mon, 2009-05-11 at 12:36 -0700, Anyuan Guo wrote:> Dear all, > I have P value of a list of markers. Now I need the chi square value > with degrees of freedom 2. > I noticed there are several Chisquare functions (dchisq, pchisq, > qchisq, and rchisq), but it seems all are not for my purpose. > In microsoft excel, there is a function CHINV to do this, such as > CHINV(0.184, 2) is 3.386, that means the chi square value for P value > 0.184, degree 2 is 3.386. > Does the R package has some function to do this? > > Thanks > > AnyuanIt never hurts to read the documentation: ?qchisq for example. Here "q" stands for "quantile." You want the Chi-square value that has 0.184 area to the left. To compute this:> qchisq(1-0.184,2)[1] 3.385639 You have to subtract 0.184 from 1, because qchisq finds the value with the given area below it. To double check the result:> 1-pchisq(3.385639,2)[1] 0.184 Rick B.
(Ted Harding)
2009-May-11 17:15 UTC
[R] anyone know how to calculate chi square value from P val
On 11-May-09 19:36:00, Anyuan Guo wrote:> Dear all, > I have P value of a list of markers. Now I need the chi square > value with degrees of freedom 2. > I noticed there are several Chisquare functions (dchisq, pchisq, > qchisq, and rchisq), but it seems all are not for my purpose. > In microsoft excel, there is a function CHINV to do this, such as > CHINV(0.184, 2) is 3.386, that means the chi square value for P value > 0.184, degree 2 is 3.386. > Does the R package has some function to do this? > > Thanks > AnyuanYes, and you already looked at it but apparently did not recognise it! Either: qchisq(1-0.184, 2) ## (note "1-0.184", since 0.184 is the upper tail) # [1] 3.385639 Or: qchisq(0.184, 2, lower.tail=FALSE) ## Default for lower.tail is TRUE # [1] 3.385639 Enter ?qchisq for more informatio0n on this and related function. Ted. -------------------------------------------------------------------- E-Mail: (Ted Harding) <Ted.Harding at manchester.ac.uk> Fax-to-email: +44 (0)870 094 0861 Date: 11-May-09 Time: 18:15:34 ------------------------------ XFMail ------------------------------
Anyuan Guo
2009-May-11 19:36 UTC
[R] anyone know how to calculate chi square value from P value?
Dear all, I have P value of a list of markers. Now I need the chi square value with degrees of freedom 2. I noticed there are several Chisquare functions (dchisq, pchisq, qchisq, and rchisq), but it seems all are not for my purpose. In microsoft excel, there is a function CHINV to do this, such as CHINV(0.184, 2) is 3.386, that means the chi square value for P value 0.184, degree 2 is 3.386. Does the R package has some function to do this? Thanks Anyuan