Skip to contents

One-proportion test (binomial exact + Wald approximation)

Usage

mrm_oneprop_test(x, n, p0, alpha = 0.05)

Arguments

x

Number of successes.

n

Number of trials.

p0

Null-hypothesis proportion.

alpha

CI level (default 0.05 -> 95% CI).

Value

Named list with p_hat, p0, n, z_wald, p_value_wald, p_value_exact, ci95_wald_lower/upper, ci95_exact_lower/upper, interpretation.

Examples

# H0: proportion = 0.5 against the observed 58/100 successes
mrm_oneprop_test(x = 58, n = 100, p0 = 0.5)
#> $p_hat
#> [1] 0.58
#> 
#> $p0
#> [1] 0.5
#> 
#> $n
#> [1] 100
#> 
#> $z_wald
#> [1] 1.6
#> 
#> $p_value_wald
#> [1] 0.1095986
#> 
#> $p_value_exact
#> [1] 0.1332106
#> 
#> $ci95_wald_lower
#> [1] 0.483264
#> 
#> $ci95_wald_upper
#> [1] 0.676736
#> 
#> $ci95_exact_lower
#> [1] 0.477119
#> 
#> $ci95_exact_upper
#> [1] 0.678014
#> 
#> $interpretation
#> [1] "p_hat = 0.5800, H0: p = 0.5; exact p = 0.133 (fail to reject H0 at alpha=0.05)."
#>