[R] Fisher's exact test

Duncan Murdoch murdoch at stats.uwo.ca
Fri Jul 17 19:00:38 CEST 2009


On 7/17/2009 12:13 PM, James Allsopp wrote:
> Hi,
> I'm trying to run Fisher's Exact test on the data below, but I'm not
> sure how interpret the data shown. Can someone tell me what this is
> saying? Looking at the numbers it should be that there's no significant
> difference between the HDL and LDL, but a p-value of 1 seems high. Is
> the low value in the LDL unbound making the test unstable and should I
> be using an alternative?

The p value of 1 says that the data could not be any more consistent 
with the hypothesis than they are. With the margins you have, there are 
only 11 possible outcomes, and your table is the most probable one under 
the hypothesis of independence.

You can see the probabilities of all possible outcomes using

dhyper(0:10, 11, 35, 10)

With rounding, I see

 > round(dhyper(0:10, 11, 35, 10), 2)
  [1] 0.05 0.19 0.32 0.27 0.13 0.04 0.01 0.00 0.00 0.00 0.00

where the results go from 0 to 10 in the lower right corner.  You had a 2.

Duncan Murdoch

> 
> Best regards
> James
> 
>> data <-
> matrix(c(27,8,9,2),nr=2,dimnames=list(c("HDL","LDL"),c("Bound","Unbound")))
>> data
>     Bound Unbound
> HDL    27       9
> LDL     8       2
>> fisher.test(data)
> 
> 	Fisher's Exact Test for Count Data
> 
> data:  data
> p-value = 1
> alternative hypothesis: true odds ratio is not equal to 1
> 95 percent confidence interval:
>  0.06629276 4.88625959
> sample estimates:
> odds ratio
>  0.7545197
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list