I would appreciate so much if someone could help me to understand the following comparisons, and tell me if I am doing the tests correctly. I want to compare two districts and their respective proportions of white over red houses. Why the pvalues are different? (please READ the EDIT below)
Dataset 1 (difference in 10% between districts):
house <- matrix(c(50,50,60,40), ncol=2, dimnames=list(c("district_A", "district_B"), c("white","red")), byrow=TRUE) prop.table(house, margin=1) fisher.test(house)
So here a sample size of 100 and a difference between districts in 10% leads to p=0.201
Dataset 2: (still same difference of 10% between districts, but now the respective proportions are different):
house2 <- matrix(c(60,40,70,30), ncol=2, dimnames=list(c("district_A", "district_B"), c("white","red")), byrow=TRUE) prop.table(house2, margin=1) fisher.test(house2)
Here a sample size of 100 and a difference between districts in 10% leads to p=0.182
Thank you very much for your kind help.
If I plot the pvalues obtained from the fisher test run on 10 datasets (10 white/90 red over 20white/80 red, 20white/80red over 30white/70 red, 30white/70red over 40white/60 red, etc.) having the same sample size (n=100) and within each dataset the difference between the two districts is 10%, this is what I obtain:
So it means that, for a fixed % difference between two groups, the closer one proportion is to 0.5, the higher is the p-value. I don't understand then, how we can rely on this as in a dataset we might conclude for a significant difference between proportions of 0.8 vs 0.9, whereas we might conclude for a NON-significant difference between proportions of 0.5 vs 0.6, assuming an equal sample size.