Two-proportion test (chi-square + Fisher exact + Wald)
Source:R/mrm_mathstats.R
mrm_twoprop_test.RdTwo-proportion test (chi-square + Fisher exact + Wald)
Value
Named list with p1, p2, diff, chi2, df, p_value_chi2, p_value_fisher, z_wald, p_value_wald, ci95_diff_lower/upper, interpretation.
Examples
# Compare 47/100 vs 31/100; two-sided test.
mrm_twoprop_test(x1 = 47, n1 = 100, x2 = 31, n2 = 100)
#> $p1
#> [1] 0.47
#>
#> $p2
#> [1] 0.31
#>
#> $diff
#> [1] 0.16
#>
#> $chi2
#> [1] 5.3804
#>
#> $df
#> [1] 1
#>
#> $p_value_chi2
#> [1] 0.02036407
#>
#> $p_value_fisher
#> [1] 0.02935582
#>
#> $z_wald
#> [1] 2.3514
#>
#> $p_value_wald
#> [1] 0.01870211
#>
#> $ci95_diff_lower
#> [1] 0.026636
#>
#> $ci95_diff_upper
#> [1] 0.293364
#>
#> $interpretation
#> [1] "p1=0.4700, p2=0.3100; Delta=0.1600; chi2(1)=5.380, p_chi2=0.0204, p_Fisher=0.0294."
#>