pair_prop_size {rashnu} | R Documentation |
Sample Size or Power for Paired-Sample Proportion Test
Description
Calculates sample size or power for a paired-sample proportion test.
Usage
pair_prop_size(p01, p10, alpha, beta = NULL, n = NULL, test_type = "2-side")
Arguments
p01 |
Numeric. Proportion of discordant pairs with (before = 1, after = 0). |
p10 |
Numeric. Proportion of discordant pairs with (before = 0, after = 1). |
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. |
test_type |
Character. |
Value
Numeric. Returns sample size (if beta
is given), or power (if n
is given).
Note
Only one of beta
(for sample size calculation) or n
(for power calculation) should be specified.
Required arguments:
For sample size:
p01
,p10
,alpha
,beta
For power:
p01
,p10
,alpha
,n
Examples
# Sample size for `"2-side"` test
pair_prop_size(p01 = 0.45, p10 = 0.05,
alpha = 0.1, beta = 0.1, test_type = "2-side")
# Power of `"2-side"` test
pair_prop_size(p01 = 0.45, p10 = 0.05,
alpha = 0.1, n = 23, test_type = "2-side")
# Sample size for `"1-side"` test
pair_prop_size(p01 = 0.45, p10 = 0.05,
alpha = 0.05, beta = 0.1, test_type = "1-side")
# Power of `"1-side"` test
pair_prop_size(p01 = 0.45, p10 = 0.05,
alpha = 0.05, n = 23, test_type = "1-side")
[Package rashnu version 0.1.2 Index]