Question: (Closed) Same results using fisher.test
0
gravatar for sugus
3 months ago by
sugus10
China Pharmaceutical University
sugus10 wrote:

Hi guys,

I want to use fisher.test() to perform association analysis but I meet a confused problem.

In a test data, different "alternative" will derive to different pValue

> fisher.test(c(1,0,1,0,0,0,1,1,1,1,1,1),c(1,0,1,1,1,1,0,0,1,0,0,0))

    Fisher's Exact Test for Count Data

data:  c(1, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1) and c(1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0)
p-value = 0.5455
alternative hypothesis: true odds ratio is not equal to 1
95 percent confidence interval:
 0.00319446 4.50042353
sample estimates:
odds ratio 
  0.230358 

> fisher.test(c(1,0,1,0,0,0,1,1,1,1,1,1),c(1,0,1,1,1,1,0,0,1,0,0,0),alternative = "less")

    Fisher's Exact Test for Count Data

data:  c(1, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1) and c(1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0)
p-value = 0.2727
alternative hypothesis: true odds ratio is less than 1
95 percent confidence interval:
 0.000000 3.151343
sample estimates:
odds ratio 
  0.230358

But in a larger data which is also binary entries with 0 and 1, the pValue is perfectly the same! Why?

> as.numeric(x)
  [1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0
 [55] 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0
[109] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
[163] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
[217] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0
> as.numeric(y)
  [1] 0 0 0 0 1 1 1 0 0 0 0 0 1 1 0 1 0 0 1 0 0 1 1 0 1 0 0 0 0 1 1 1 1 1 1 1 1 0 0 1 0 1 0 0 1 0 1 0 1 1 1 1 1 1
 [55] 1 0 1 0 0 1 0 1 0 0 1 1 1 0 0 0 0 0 0 0 0 1 0 0 0 1 1 0 1 1 1 0 1 0 0 0 0 0 1 1 1 1 0 1 1 1 1 1 0 1 1 1 1 0
[109] 0 0 0 1 1 1 1 0 1 1 1 1 1 1 1 0 1 0 1 1 0 1 1 0 1 0 1 1 1 1 1 1 1 0 0 0 1 0 1 0 0 0 0 1 0 1 1 0 1 0 0 0 1 1
[163] 0 0 1 1 0 0 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 0 1 0 1 0 1 0 0 1 1 1 1 0 1 1 0 0 0 1 1 1 1 1 0 1 1 0 0 1 0 0 1 1
[217] 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 0 1 1 1 1 0 1 1
> fisher.test(as.numeric(x),as.numeric(y),alternative = "two.side")

    Fisher's Exact Test for Count Data

data:  as.numeric(x) and as.numeric(y)
p-value = 0.0002977
alternative hypothesis: true odds ratio is not equal to 1
95 percent confidence interval:
 0.001366782 0.412310161
sample estimates:
odds ratio 
0.05916957 

> fisher.test(as.numeric(x),as.numeric(y),alternative = "less")

    Fisher's Exact Test for Count Data

data:  as.numeric(x) and as.numeric(y)
p-value = 0.0002977
alternative hypothesis: true odds ratio is less than 1
95 percent confidence interval:
 0.000000 0.337174
sample estimates:
odds ratio 
0.05916957

Hope somebody could give this an explaination. Thx a lot!

one-side two-side fisher.test • 165 views
ADD COMMENTlink written 3 months ago by sugus10

CrossValidated is a better place for your question.

ADD REPLYlink written 3 months ago by h.mon15k

Hello sugus!

We believe that this post does not fit the main topic of this site.

Not a bioinformatics question.

For this reason we have closed your question. This allows us to keep the site focused on the topics that the community can help with.

If you disagree please tell us why in a reply below, we'll be happy to talk about it.

Cheers!

ADD REPLYlink written 3 months ago by h.mon15k
Please log in to add an answer.
The thread is closed. No new answers may be added.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1851 users visited in the last hour