Skip to main content
5 of 6
deleted 1 character in body
BruceET
  • 57.6k
  • 2
  • 36
  • 94

A test of two binomial proportions in R, seems appropriate to test $H_0: p_1=p_2$ against $H_a: p_1 \ne p_2.$ The two estimated proportions are $\hat p_1 = 40/300 = 0.13$ and $\hat p_2 = 200/1000 = 0.20,$ so the observed proportions are different. Then prop.test in R gives a P-value $0.009 < 0.01 = 1\%,$ so the difference is statistically significant at the 1% level.

prop.test(c(40, 200), c(300,1000), cor=F)

    2-sample test for equality of proportions 
    without continuity correction

data:  c(40, 200) out of c(300, 1000)
X-squared = 6.8134, df = 1, p-value = 0.009048
alternative hypothesis: two.sided
95 percent confidence interval:
  -0.11243026 -0.02090307
 sample estimates:
   prop 1    prop 2 
0.1333333 0.2000000 

Notes: (1) Your table is in the correct format for a chi-squared test, shown below. (The different sample sizes are not a problem.) It gives the same P-value as 'prop.test',

TAB = rbind(c(200,40), c(800, 260))
TAB
     [,1] [,2]
[1,]  200   40
[2,]  800  260

chisq.test(TAB, cor=F)

        Pearson's Chi-squared test

data:  TAB
X-squared = 6.8134, df = 1, p-value = 0.009048

(2) I did not use the continuity correctios for the normal approximation in either test on account of the sample sizes over 100.

(3) A test similar to prop.test, which you can try with hand computation is described on this NIST page.

BruceET
  • 57.6k
  • 2
  • 36
  • 94