coxph_size {rashnu} | R Documentation |
Sample Size or Power for Cox Proportional Hazards
Description
Calculates sample size or power for a cox proportional hazards model.
Usage
coxph_size(
hr,
hr0 = NULL,
delta = NULL,
pE,
pA,
alpha,
beta = NULL,
n = NULL,
test_type = "2-side"
)
Arguments
hr |
Numeric. True hazard ratio. |
hr0 |
Numeric (optional). Null hypothesis hazard ratio. Required for |
delta |
Numeric (optional). Margin for |
pE |
Numeric. Overall event probability. |
pA |
Numeric. Proportion of group A. |
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 by test_type
:
-
"2-side"
/"non-inferiority
:For sample size:
hr
,hr0
,pE
,pA
,alpha
,beta
For power:
hr
,hr0
,pE
,pA
,alpha
,n
-
"equivalence"
:For sample size:
hr
,delta
,pE
,pA
,alpha
,beta
For power:
hr
,delta
,pE
,pA
,alpha
,n
Examples
# Sample size for a `"2-side"` test
coxph_size(hr = 2, hr0 = 1, pE = 0.8, pA = 0.5,
alpha = 0.05, beta = 0.2, test_type = "2-side")
# Power of `"2-side"` test
coxph_size(hr = 2, hr0 = 1, pE = 0.8, pA = 0.5,
alpha = 0.05, n = 82, test_type = "2-side")
# Sample size for `"non-inferiority"` test
coxph_size(hr = 2, hr0 = 1, pE = 0.8, pA = 0.5,
alpha = 0.025, beta = 0.2, test_type = "non-inferiority")
# Power of `"non-inferiority"` test
coxph_size(hr = 2, hr0 = 1, pE = 0.8, pA = 0.5,
alpha = 0.025, n = 82, test_type = "non-inferiority")
# Sample size for `"equivalence"` test
coxph_size(hr = 1, delta = 0.5, pE = 0.8, pA = 0.5,
alpha = 0.05, beta = 0.2, test_type = "equivalence")
# Power of `"equivalence"` test
coxph_size(hr = 1, delta = 0.5, pE = 0.8, pA = 0.5,
alpha = 0.05, n = 172, test_type = "equivalence")