Fisher exact test does not give expected results in R -
i want test if counts of greater counts of b. i'm trying use fisher exact test gives me different results depending on how arrange data. dont know if problem comes particular dataset (too many zeros) or if comes way arranged.
first, tried constructing contingency table (m) explained in internet.
factor counts b 0 205 226 1 33 29 2 15 18 3 13 8 4 4 2 5 5 1 6 3 0 7 2 0 9 1 0 12 2 0 23 1 0 fisher.test(m, workspace = 200000, hybrid = false, control = list(), or = 1, alternative = "two.sided", conf.int = true, conf.level = 0.95, simulate.p.value = t, b = 2000) #results: data: m pvalue = 0.1184 alternative hypothesis: two.sided
this gives me insignificant differences, totally unexpected when looking @ data , table. dataset big , complicated post here or simulate, can send interested.
however, if create matrix of contingency table...
classes=c(0,1,2,3,4,5,6,7,9,12,23) a=c(205,33,15,13,4,5,3,2,1,2,1) b=c(226,29,18,8,2,1,0,0,0,0,0) m=as.matrix(data.frame(classes,a,b)) fisher.test(m, workspace = 200000, hybrid = false, control = list(), or = 1, alternative = "two.sided", conf.int = true, conf.level = 0.95, simulate.p.value = t, b = 2000) #results: data: m p-value = 0.0004998 alternative hypothesis: two.sided
which correct procedure? if first, how possible such big differences not significant??
thanks
that first item may r contingency table (which matrix in disguise) first "column" bunch of rownames. when make data.frame rownames , coerce matrix , pass fisher.test
same result, when make matrix ... without column:
m=matrix( cbind(a,b),,2) rownames(m)=classes > m [,1] [,2] 0 205 226 1 33 29 2 15 18 3 13 8 4 4 2 5 5 1 6 3 0 7 2 0 9 1 0 12 2 0 23 1 0 > as.matrix(d) b 0 205 226 1 33 29 2 15 18 3 13 8 4 4 2 5 5 1 6 3 0 7 2 0 9 1 0 12 2 0 23 1 0 > fisher.test( as.matrix(d) ) fisher's exact test count data data: as.matrix(d) p-value = 0.1197 alternative hypothesis: two.sided > fisher.test(m) fisher's exact test count data data: m p-value = 0.1197 alternative hypothesis: two.sided
please clarify statistical (mis?)-understanding on matter professor or folks @ cv.com. minor numerical difference between p-value , 2 ones showed because insisted on "real" exact test in first instance. part of loss of power detect both suspect should statistically significant difference long tail of distributions small numbers. gets handled improperly fisher.test. furthermore statistical power diminished degrees of freedom. more power testing 2 exponential variates .... that, too, matter statistical discussion.
Comments
Post a Comment