n_chisq: Sample Size Calculation for the Chi-Square Test

Description Usage Arguments Details Value Examples

View source: R/n_chisq.R

Description

n_chisq performs the Sample Size calculation for two independent samples with binary data using the absolute rate difference quantifying the effect of an intervention. The method used here is based on the pages 21 - 26 in [1]. The Sample Size is calculated using an iterative approach, recalculating the exact power, the sum of all discrete combinations fullfilling the alternative hypothesis to the approximative test for rising group sizes n. See p. 23 in [1] for further details.

Usage

1
n_chisq(p_Y, p_X, alpha, power, r, power.exact = TRUE)

Arguments

p_Y

Event rate of Group Y on the alternative.

p_X

Event rate of Group X on the alternative.

alpha

Significance level α.

power

Desired Power 1-β.

r

Quotient of Sample sizes r = n_Y / n_X.

power.exact

Default = TRUE. If set to FALSE an approximative formula is used for calculating the sample size, given by (5.7a) in [1]. On TRUE the iterative approach is used.

Details

Null Hypothesis:

p_Y - p_X = 0

Alternative Hypothesis:

|p_Y - p_X| ≥ Δ_A

[1] M.Kieser: Fallzahlberechnung in der medizinischen Forschung [2018], 1th Edition

Value

n_chisq returns an object of type list. The resulting Sample Sizes are located in entrys named n_X, n_Y, n. The resulting power is named power_out.

Examples

1
2
3
n_chisq(p_Y = .5, p_X = .3, alpha = .05, power = .8, r = 2)
n_chisq(p_Y = .5, p_X = .3, alpha = .05, power = .8, r = 2)$n
n_chisq(p_Y = .5, p_X = .3, alpha = .05, power = .8, r = 2, power.exact = FALSE)

goseberg/samplesizr documentation built on May 28, 2019, 8:43 a.m.