chi squared test
2
0
Entering edit mode
Hai-Ri Li ▴ 20
@hai-ri-li-3503
Last seen 10.3 years ago
Hi everyone, When I tried to use chisq.test or fisher.test in bioconductor, I always got higher p-value than that with other sources. For example, I have two observed values 15 and 5 and two expected values 10 and 10. Using other sources such as Excel from Microsoft, I got p-value 0.025. However, in bioconductor, *chisq*.*test*(x=matrix(c(15,5,10,10),nc=2),correct=FALSE) or *chisq*.*test*(x=matrix(c(15,10,5,10),nc=2),correct=FALSE) p-value always is 0.1025. Did I do something wrong? Please tell me why there is big difference in p-value. How can I get low p-value in bioconductor? Thanks, Hai-Ri [[alternative HTML version deleted]]
• 917 views
ADD COMMENT
0
Entering edit mode
rgentleman ★ 5.5k
@rgentleman-7725
Last seen 9.6 years ago
United States
Hi Hai, This is an R question, not a Bioconductor question. You should ask your question there. Also, for all of these tests, you can simply do the calculation and look up the answer. There is no real reason to ask anyone on a mailing list for help at this level. The manual pages for the tests will reveal to you what numbers you need to input. In particular: If 'x' is a matrix with at least two rows and columns, it is taken as a two-dimensional contingency table. and that is not what you are doing - so that is the most likely the answer to your question. You really have to read the manual page. best wishes Robert Hai-Ri Li wrote: > Hi everyone, > > When I tried to use chisq.test or fisher.test in bioconductor, I always got > higher p-value than that with other sources. > > For example, I have two observed values 15 and 5 and two expected values 10 > and 10. > > Using other sources such as Excel from Microsoft, I got p-value 0.025. > > However, in bioconductor, > > *chisq*.*test*(x=matrix(c(15,5,10,10),nc=2),correct=FALSE) > > or > > *chisq*.*test*(x=matrix(c(15,10,5,10),nc=2),correct=FALSE) > > p-value always is 0.1025. > > Did I do something wrong? > > Please tell me why there is big difference in p-value. How can I get low > p-value in bioconductor? > > Thanks, > > Hai-Ri > > [[alternative HTML version deleted]] > > _______________________________________________ > Bioconductor mailing list > Bioconductor at stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor > -- Robert Gentleman, PhD Program in Computational Biology Division of Public Health Sciences Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N, M1-B514 PO Box 19024 Seattle, Washington 98109-1024 206-667-7700 rgentlem at fhcrc.org
ADD COMMENT
0
Entering edit mode
@james-w-macdonald-5106
Last seen 18 hours ago
United States
Hi Hai-Ri, Hai-Ri Li wrote: > Hi everyone, > > When I tried to use chisq.test or fisher.test in bioconductor, I always got > higher p-value than that with other sources. Both of these functions come as part of base R; they are not part of Bioconductor, so your question should be sent to r-help at r-project.org. > > For example, I have two observed values 15 and 5 and two expected values 10 > and 10. > > Using other sources such as Excel from Microsoft, I got p-value 0.025. > > However, in bioconductor, > > *chisq*.*test*(x=matrix(c(15,5,10,10),nc=2),correct=FALSE) > > or > > *chisq*.*test*(x=matrix(c(15,10,5,10),nc=2),correct=FALSE) > > p-value always is 0.1025. > > Did I do something wrong? Yes. Excel expects you to give it the observed _and_ expected values. R will calculate the expectation for you, so when you give those data to R, the assumption (as is explained in the help page for chisq.test) is that you are giving it a two-by-two table of observed counts. > z <- chisq.test(matrix(c(15,10,5,10), nc=2), correct=F) > z$expected [,1] [,2] [1,] 12.5 7.5 [2,] 12.5 7.5 So if you put 15 5 10 10 In e.g. A1:B2 of an Excel spreadsheet and 12.5 7.5 12.5 7.5 in A3:B4 and then do =chitest(A1:B2,A3:B4) you will get 0.10247, just like in R. Best, Jim > > Please tell me why there is big difference in p-value. How can I get low > p-value in bioconductor? > > Thanks, > > Hai-Ri > > [[alternative HTML version deleted]] > > _______________________________________________ > Bioconductor mailing list > Bioconductor at stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor -- James W. MacDonald, M.S. Biostatistician Douglas Lab University of Michigan Department of Human Genetics 5912 Buhl 1241 E. Catherine St. Ann Arbor MI 48109-5618 734-615-7826
ADD COMMENT

Login before adding your answer.

Traffic: 542 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6