Learn R Programming

rashnu (version 0.1.2)

one_bino_size: Sample Size or Power for One-Sample Binomial Proportion Test

Description

Calculates sample size or power for a two-sample binomial proportion test.

Usage

one_bino_size(p, p0, alpha, beta = NULL, n = NULL)

Value

Numeric. Returns sample size (if beta is given), or power (if n is given).

Arguments

p

Numeric. True proportion.

p0

Numeric. Null hypothesis proportion.

alpha

Numeric. Type I error rate.

beta

Numeric (optional). Type II error rate. Required for sample size calculation.

n

Integer (optional). Sample size. Required for power calculation.

Examples

Run this code
# Required sample size
one_bino_size(p = 0.5, p0 = 0.3,
              alpha = 0.05, beta = 0.2)

# Power
one_bino_size(p = 0.5, p0 = 0.3,
              alpha = 0.05, n = 50)

Run the code above in your browser using DataLab