Learn R Programming

rashnu (version 0.1.2)

k_prop_size: Sample Size or Power Calculation for K proportion

Description

Calculates sample size or power for a multiple-sample proportion test.

Usage

k_prop_size(pA, pB, tau, alpha, beta = NULL, n = NULL)

Value

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

Arguments

pA

Numeric. True proportion of group A.

pB

Numeric. True proportion of group B.

tau

Integer. Number of comparisons.

alpha

Numeric. Type I error rate.

beta

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

n

Integer (optional). Sample size. Required when calculating power.

Examples

Run this code
# Sample size
k_prop_size(pA = 0.2, pB = 0.4, tau = 2,
            alpha = 0.05, beta = 0.2)

# Power
k_prop_size(pA = 0.2, pB = 0.4, tau = 2,
            alpha = 0.05, n = 96)

Run the code above in your browser using DataLab