0

I am trying to find out if two proportions from the same sample are different or not.

(let's imagine) I have a sample with 200 answers: 120 like Party A , 100 like Party B It is possible to like two parties at the same time.

I would like to test whether there is a significance difference in proportion of liking party A or party B.

I see several ways to answer that but none of them seems really satisfying to me:

  • Two proportions, two samples test:
prop.test(x = c(120, 100), n = c(200, 200))

This gives: p-value = 0.05619 (there is no difference between liking proportion for party A and B). However this does not take into account the fact that 120 and 100 are not independent.

  • Confidence interval for both proportions:
prop.test(x = 120, n = 200)
prop.test(x = 100, n = 200)

This gives 95% proportion: [0.5283160, 0.6677775] for liking for Party A and [0.4313609, 0.5686391] for liking for Party B. These confidence intervals overlap, so there is no difference in liking proportion for party A and B. However two confidence intervals with 95% confidence does not make a significance test with 95% confidence.

  • Confidence interval for the difference: There are 20 more people that likes party A than party B in a sample of 200.
prop.test(x = 20, n = 200)

95% Confidence interval is [0.06366294 0.15229666], this does not include 0. Party A has a significantly different proportion of liking than Party B. This tells me that 20 people out of 200 is not 0%, but is it exactly what I want to know?

I am not sure what those three options actually tell me, is there a better way to answer my original question?

indirectly
  • 11
  • 1
  • 3
  • What do you mean include 0? Do you want it to be from a negative to a positive so as to include 0? But prop can never be negative – Onyambu Jun 01 '21 at 19:32
  • If proportion for party A=proportion for party B; the difference between both of them will be 0 In the third method I want to test between the 20 people difference can be considered as 0 (there is no difference in liking for party A and B) or not be considered as 0 (there is a difference in liking for party A and B) – indirectly Jun 01 '21 at 19:42
  • If you are testing for the difference then you do `prop.test(x = c(120, 100), n = c(200, 200))` and check the confidence interval. `prop(20,200)` is not checking for the difference – Onyambu Jun 01 '21 at 19:46
  • Thanks, you are right, I just realized that prop.test(x = 1, n = 200) gives a confidence interval that does not include 0; so this does not test what I wanted it to test; i.e. is the difference in proportion between liking in both party 0 or not. Isn't prop.test(x = c(120, 100), n = c(200, 200)) testing whether 120 in a sample of 200 is equal to a proportion of 100 in *another* sample? (which is slightly different to my question) – indirectly Jun 01 '21 at 19:53
  • `prop.test(x = c(120, 100), n = c(200, 200), p = 0)` does exactly that – Onyambu Jun 01 '21 at 19:54
  • prop.test(x = c(120, 100), n = c(200, 200), p = 0) gives me: Error in prop.test(x = c(120, 100), n = c(200, 200), p = 0) : 'p' must have the same length as 'x' and 'n' – indirectly Jun 01 '21 at 20:00
  • 1
    Just do `prop.test(x = c(120, 100), n = c(200, 200)) ` That should work. And the confidence interval should contain 0 if it the two are not significantly different – Onyambu Jun 01 '21 at 20:03

0 Answers0