Displaying 1 result from an estimated 1 matches for "n2_".
Did you mean:
n2
2009 Oct 16
1
How odds ratio is computed in fisher.test()?
I'm wondering how odds ratio is computed. I thought that it is
(n11/n12)/(n21/n22), but it is not what fisher.test() computes. Could
somebody let me know?
> n11=3
> n12=1
> n21=1
> n22=3
>
> n1_=n11+n12
> n2_=n21+n22
>
> n_1=n11+n21
> n_2=n12+n22
>
> x=rbind(c(n11,n12),c(n21,n22))
>
> threshold=dhyper(n11,n1_,n2_,n_1)
> probability=dhyper(0:n_1,n1_,n2_,n_1)
> sum(probability[probability<=threshold])
[1] 0.4857143
> (n11/n12)/(n21/n22)
[1] 9
> fisher.test(x)
F...