pvalue/p-value calculation
HYPERGEOMETRIC TEST
http://mengnote.blogspot.com/2012/12/calculate-correct-hypergeometric-p.html
# x, q vector of quantiles representing the number of white balls drawn without replacement from an urn which contains both black and white balls.
# m the number of white balls in the urn.
# n the number of black balls in the urn.
# k the number of balls drawn from the urn.
# phyper(q, m, n, k, lower.tail = TRUE, log.p = FALSE)
sucessDrawn=1
sucessTotal=2
sampleSize=24
populatonSizeWithoutSample=1751-sampleSize
phyper(sucessDrawn-1, sucessTotal, populatonSizeWithoutSample, sampleSize, lower.tail = FALSE, log.p = FALSE)
FISHER EXACT TEST
Bonferroni correction: Pvalue* (#of test cases)
http://www.une.edu.au/WebStat/unit_materials/c7_anova/oneway_bonferroni_adjust.htm
http://www.langsrud.com/stat/fisher.htm
Code done by
Benoit Marchand
/*
* pvalcalc.cpp
* Author:
Benoit Marchand
*/
#include
#include
Fisher 's exact test in R package: stats
===========================
myContin = matrix(c(1,4,7,4), nrow = 2);
fisher.test(myContin ,alternative = "two.sided" ) ; // two sided
fisher.test(myContin ,alternative = "greater" ) ; // right-hand sided
fisher.test(myContin ,alternative = "less" ) ; // left-hand sided
Comments
Post a Comment