Title: | Design and Analysis of a 2x2 Factorial Trial |
---|---|
Description: | Used for the design and analysis of a 2x2 factorial trial for a time-to-event endpoint. It performs power calculations and significance testing as well as providing estimates of the relevant hazard ratios and the corresponding 95% confidence intervals. Important reference papers include Slud EV. (1994) <https://www.ncbi.nlm.nih.gov/pubmed/8086609> Lin DY, Gong J, Gallo P, Bunn PH, Couper D. (2016) <DOI:10.1111/biom.12507> Leifer ES, Troendle JF, Kolecki A, Follmann DA. (2020) <https://github.com/EricSLeifer/factorial2x2/blob/master/Leifer%20et%20al.%20paper.pdf>. |
Authors: | Eric Leifer and James Troendle |
Maintainer: | Eric Leifer <[email protected]> |
License: | GPL-2 |
Version: | 0.2.0 |
Built: | 2025-02-13 04:42:41 UTC |
Source: | https://github.com/cran/factorial2x2 |
Computes the hazard ratios, confidence intervals, p-values, and correlations for the overall A, simple A, and simple AB logrank statistics.
cor2x2(time, event, indA, indB, covmat)
cor2x2(time, event, indA, indB, covmat)
time |
follow-up times |
event |
event indicators (0/1) |
indA |
treatment A indicators (0/1) |
indB |
treatment B indicators (0/1) |
covmat |
matrix of covariates; one row per subject. NOTE!! Factor variables must use 0/1 indicator variables |
This function computes (i) correlation between the overall A test and the simple A test (ii) correlation between the overall A test and the simple AB test (iii) correaltion between the simple A and simple AB test. The correlation estimates are derived in Lin, Gong, Gallo, et al. (Biometrics 2016).
loghrA |
overall A log hazard ratio |
seA |
standard error of the overall A log hazard ratio |
hrA |
overall A hazard ratio |
ciA |
95% confidence interval for overall A hazard ratio |
pvalA |
two-sided p-value for overall A hazard ratio |
loghra |
simple A log hazard ratio |
sea |
standard error of the simple A log hazard ratio |
hra |
simple A hazard ratio |
cia |
95% confidence interval for simple A hazard ratio |
pvala |
two-sided p-value for simple A hazard ratio |
loghrab |
simple AB log hazard ratio |
seab |
standard error of the simple AB log hazard ratio |
hrab |
simple AB hazard ratio |
ciab |
95% confidence interval for simple AB hazard ratio |
pvalab |
two-sided p-value for simple AB hazard ratio |
corAa |
correlation between the overall A and simple A test statistics |
corAab |
correlation between the overall A and simple AB test statistics |
coraab |
correlation between the simple A and simple AB test statistics |
Lin, D.Y., Glong , J., Gallo, P., Bunn, P.H., Couper, D. Simultaneous inference on treatment effects in survival studies with factorial designs. Biometrics, 2016; 72: 1078-1085.
# First load the simulated data variables. The "simdat" file is # a 100-by-9 matrix which is loaded with the factorial2x2 package. time <- simdat[, "time"] event <- simdat[, "event"] indA <- simdat[, "indA"] indB <- simdat[, "indB"] covmat <- simdat[, 6:10] cor2x2(time, event, indA, indB, covmat) # $loghrA # [1] 0.05613844 # $seA # [1] 0.4531521 # $hrA # [1] 1.057744 # $ciA # [1] 0.4351608 2.5710556 # $pvalA # [1] 0.9014069 # $loghra # [1] 0.1987329 # $sea # [1] 0.6805458 # $hra # [1] 1.219856 # $cia # [1] 0.3213781 4.6302116 # $pvala # [1] 0.7702714 # $loghrab # [1] 0.2864932 # $seab # [1] 0.6762458 # $hrab # [1] 1.331749 # $ciab # [1] 0.3538265 5.0125010 # $pvalab # [1] 0.6718193 # $corAa # [1] 0.6123399 # $corAab # [1] 0.5675396 # $coraab # [1] 0.4642737
# First load the simulated data variables. The "simdat" file is # a 100-by-9 matrix which is loaded with the factorial2x2 package. time <- simdat[, "time"] event <- simdat[, "event"] indA <- simdat[, "indA"] indB <- simdat[, "indB"] covmat <- simdat[, 6:10] cor2x2(time, event, indA, indB, covmat) # $loghrA # [1] 0.05613844 # $seA # [1] 0.4531521 # $hrA # [1] 1.057744 # $ciA # [1] 0.4351608 2.5710556 # $pvalA # [1] 0.9014069 # $loghra # [1] 0.1987329 # $sea # [1] 0.6805458 # $hra # [1] 1.219856 # $cia # [1] 0.3213781 4.6302116 # $pvala # [1] 0.7702714 # $loghrab # [1] 0.2864932 # $seab # [1] 0.6762458 # $hrab # [1] 1.331749 # $ciab # [1] 0.3538265 5.0125010 # $pvalab # [1] 0.6718193 # $corAa # [1] 0.6123399 # $corAab # [1] 0.5675396 # $coraab # [1] 0.4642737
Computes the critical values for null hypotheses rejection and corresponding nominal two-sided significance levels for the Equal Allocation 3, Proportional Allocation 2, and Equal Allocation 2 procedures
crit2x2( corAa, corAab, coraab, dig = 2, alpha = 0.05, niter = 5, abseps = 1e-05, tol = 1e-04 )
crit2x2( corAa, corAab, coraab, dig = 2, alpha = 0.05, niter = 5, abseps = 1e-05, tol = 1e-04 )
corAa |
correlation between the overall A and simple A log hazard ratio estimates |
corAab |
correlation between the overall A and simple AB log hazard ratio estimates |
coraab |
correlation between the simple A and simple AB log hazard ratio estimates |
dig |
number of decimal places to which we |
alpha |
two-sided familywise error level to control |
niter |
number of times we compute the critical values to average out
the randomness from the |
abseps |
|
tol |
|
This function computes the Dunnett-corrected critical values
based on the asymptotic correlations of the overall A, simple A, and simple AB
logrank statistics as described in Leifer, Troendle, et al. (2020) and are derived in
Lin, Gong, et al. (2016) and Slud (1994). pmvnorm
uses a random seed in its algorithm.
To smooth out the randomness, pmvnorm
is called niter
times.
The roundDown
function is used in conjunction with the dig
argument
to insure that any rounding of the (negative) critical values will be done conservatively to control
the familywise type I error at the desired level.
critEA3 |
Equal Allocation 3 procedure's critical value for all three test statistics |
sigEA3 |
two-sided nominal significance level corresponding to |
critPA2A |
Proportional Allocation 2 procedure's critical value for the overall A statistic |
sigPA2A |
two-sided nominal significance level corresponding to |
critPA2ab |
Proportional Allocation 2 procedure's critical value for the simple AB statistic |
sigPA2ab |
two-sided nominal significance level corresponding to |
critEA2 |
Equal Allocation 2 procedure's critical value for the simple A and AB statistics |
sigEA2 |
two-sided nominal significance level corresponding to |
Leifer, E.S., Troendle, J.F., Kolecki, A., Follmann, D. Joint testing of overall and simple effect for the two-by-two factorial design. 2020. Submitted.
Lin, D-Y., Gong, J., Gallo, P., et al. Simultaneous inference on treatment effects in survival studies with factorial designs. Biometrics. 2016; 72: 1078-1085.
Slud, E.V. Analysis of factorial survival experiments. Biometrics. 1994; 50: 25-38.
roundDown
. eventProb
, lgrkPower
, strLgrkPower
, pmvnorm
# Example 1: Compute the nominal significance levels for rejection using # the asymptotic correlations derived in Slud (1994) corAa <- 1/sqrt(2) corAab <- 1/sqrt(2) coraab <- 1/2 crit2x2(corAa, corAab, coraab, dig = 2, alpha = 0.05, niter = 5) # critEA3 # [1] -2.32 # sigEA3 # [1] 0.02034088 # critPA2A # [1] -2.13 # sigPA2A # [1] 0.03317161 # critPA2ab # [1] -2.24 # sigPA2ab # [1] 0.02509092 # critEA2 # [1] -2.22 # sigEA2 # [1] 0.02641877 # Example 2: Compute the nominal critical values and significance levels for rejection # using the estimated correlations for simdat. corAa <- 0.6123399 corAab <- 0.5675396 coraab <- 0.4642737 crit2x2(corAa, corAab, coraab, dig = 2, alpha = 0.05, niter = 5) # $critEA3 # [1] -2.34 # $critPA2A # [1] -2.13 # $sigPA2A # [1] 0.03317161 # $critPA2ab # [1] -2.3 # $sigPA2ab # [1] 0.02144822 # # $sigEA3 # [1] 0.01928374 # $critEA2 # [1] -2.22 # $sigEA2 # [1] 0.02641877
# Example 1: Compute the nominal significance levels for rejection using # the asymptotic correlations derived in Slud (1994) corAa <- 1/sqrt(2) corAab <- 1/sqrt(2) coraab <- 1/2 crit2x2(corAa, corAab, coraab, dig = 2, alpha = 0.05, niter = 5) # critEA3 # [1] -2.32 # sigEA3 # [1] 0.02034088 # critPA2A # [1] -2.13 # sigPA2A # [1] 0.03317161 # critPA2ab # [1] -2.24 # sigPA2ab # [1] 0.02509092 # critEA2 # [1] -2.22 # sigEA2 # [1] 0.02641877 # Example 2: Compute the nominal critical values and significance levels for rejection # using the estimated correlations for simdat. corAa <- 0.6123399 corAab <- 0.5675396 coraab <- 0.4642737 crit2x2(corAa, corAab, coraab, dig = 2, alpha = 0.05, niter = 5) # $critEA3 # [1] -2.34 # $critPA2A # [1] -2.13 # $sigPA2A # [1] 0.03317161 # $critPA2ab # [1] -2.3 # $sigPA2ab # [1] 0.02144822 # # $sigEA3 # [1] 0.01928374 # $critEA2 # [1] -2.22 # $sigEA2 # [1] 0.02641877
Calculates the event probabilities for each of the four factorial groups C, A, B, AB. The time unit is in years, but of course, any time unit could be used. Average event probabilities across various combinations of the groups are also calculated. The event times are assumed to be exponentially distributed. The censoring times are assumed to be uniformly distributed and indepedent of the event times.
eventProb(rateC, hrA, hrB, hrAB, mincens, maxcens)
eventProb(rateC, hrA, hrB, hrAB, mincens, maxcens)
rateC |
group C one year event rate |
hrA |
group A to group C hazard ratio |
hrB |
group B to group C hazard ratio |
hrAB |
group AB to group C hazard ratio |
mincens |
minimum censoring time |
maxcens |
maximum censoring time |
hazC |
group C's exponential hazard rate |
probC |
event probability of the C group |
probA |
event probability of the A group |
probB |
event probability of the B group |
probAB |
event probability of the AB group |
avgprob |
average event probability across all factorial groups |
probA_C |
average event probablity of the A and C groups |
probAB_C |
average event probablity of the AB and C groups |
# Corresponds to scenario 5 of Table 2 from Leifer, Troendle, et al. (2019). rateC <- 0.0445 hrA <- 0.80 hrB <- 0.80 hrAB <- 0.72 mincens <- 4.0 maxcens <- 8.4 eventProb(rateC, hrA, hrB, hrAB, mincens, maxcens) # hazC # [1] 0.04552052 # probC # [1] 0.2446365 # probA # [1] 0.201254 # probB # [1] 0.201254 # probAB # [1] 0.1831806 # avgprob # [1] 0.2075813 # probAB_C # [1] 0.2139086
# Corresponds to scenario 5 of Table 2 from Leifer, Troendle, et al. (2019). rateC <- 0.0445 hrA <- 0.80 hrB <- 0.80 hrAB <- 0.72 mincens <- 4.0 maxcens <- 8.4 eventProb(rateC, hrA, hrB, hrAB, mincens, maxcens) # hazC # [1] 0.04552052 # probC # [1] 0.2446365 # probA # [1] 0.201254 # probB # [1] 0.201254 # probAB # [1] 0.1831806 # avgprob # [1] 0.2075813 # probAB_C # [1] 0.2139086
Performs significance testing for the Proportional Allocation 2, Equal Allocation 3, Equal Allocation 2 procedures. Also reports the hazard ratios, 95% confidence intervals, p-values, nominal significance levels, and correlations for the overall and simple test statistics.
fac2x2analyze(time, event, indA, indB, covmat, alpha, dig = 2, niter = 5)
fac2x2analyze(time, event, indA, indB, covmat, alpha, dig = 2, niter = 5)
time |
follow-up times |
event |
event indicators (0/1) |
indA |
treatment A indicators (0/1) |
indB |
treatment B indicators (0/1) |
covmat |
covariate matrix, must be non-NULL. Factor variables MUST use 0/1 dummy variables |
alpha |
two-sided familywise significance level |
dig |
number of decimal places to which we |
niter |
number of interations passed to |
For each of the three multiple testing procedures, the critical values for the overall A (respectively, simple A) logrank statistics may be slightly different from the overall B (respectively, simple B) logrank statistics. This is due to their slightly different correlations with each other (i.e., correlation between overall A and simple A, respectively, overall B and simple B, statistics) as well as with the simple AB statistic.
loghrAoverall |
overall A log hazard ratio |
seAoverall |
standard error of the overall A log hazard ratio |
ZstatAoverall |
Z-statistic for the overall A log hazard ratio |
pvalAoverall |
two-sided p-value for the overall hazard ratio |
hrAoverall |
overall A hazard ratio |
ciAoverall |
95% confidence interval for the overall A hazard ratio |
loghrAsimple |
simple A log hazard ratio |
seAsimple |
standard error of the simple A log hazard ratio |
ZstatAsimple |
Z-statistic for the simple A log hazard ratio |
pvalAsimple |
two-sided p-value for the simple A hazard ratio |
hrAsimple |
simple A hazard ratio |
ciAsimple |
95% confidence interval for the simple A hazard ratio |
loghrABsimple |
simple AB log hazard ratio |
seABsimple |
standard error of the simple AB log hazard ratio |
ZstatABsimple |
Z-statistic for the simple AB log hazard ratio |
pvalABsimple |
two-sided p-value for the simple AB hazard ratio |
hrABsimple |
simple AB hazard ratio |
ciABsimple |
95% confidence interval for the simple AB hazard ratio |
critEA3_A |
Equal Allocation 3's critical value for the overall A simple A, and simple AB hypotheses |
sigEA3_A |
Equal Allocation 3's p-value rejection criterion for the overall A, simple A, and simple AB hypotheses |
resultEA3_A |
Equal Allocation 3's accept/reject decisions for the overall A, simple A, and simple AB hypotheses |
critPA2overallA |
Proportional Allocation 2's critical value for the overall A statistic |
sigPA2overallA |
Proportional Allocation 2's p-value rejection criterion for the overall A hypothesis |
critPA2simpleAB |
Proportional Allocation 2's critical value for the simple AB hypothesis |
sigPA2simpleAB |
Proportional Allocation 2 procedure's p-value rejection criterion for the simple AB hypothesis |
resultPA2_A |
Proportional Allocation 2 procedure's accept/reject decisions for the overall A and simple A hypotheses |
critEA2_A |
Equal Allocation 2 procedure's critical value for the simple A and simple AB hypotheses |
sigEA2_A |
Equal Allocation 2 procedure's p-value rejection criterion for the simple A and simple AB hypotheses |
resultEA2_A |
Equal Allocation 2 procedure's accept/reject decisions for the simple A and simple AB hypotheses |
corAa |
correlation between the overall A and simple A logrank statistics |
corAab |
correlation between the overall A and simple AB logrank statistics |
coraab |
correlation between the simple A and simple AB logrank statistics |
Eric Leifer, James Troendle
Leifer, E.S., Troendle, J.F., Kolecki, A., Follmann, D. Joint testing of overall and simple effect for the two-by-two factorial design. (2020). Submitted.
Lin, D-Y., Gong, J., Gallo, P., et al. Simultaneous inference on treatment effects in survival studies with factorial designs. Biometrics. 2016; 72: 1078-1085.
Slud, E.V. Analysis of factorial survival experiments. Biometrics. 1994; 50: 25-38.
# First load the simulated data variables. The "simdataSub" file is # a 100-by-9 matrix which is loaded with the factorial2x2 package. time <- simdataSub[, "time"] event <- simdataSub[, "event"] indA <- simdataSub[, "indA"] indB <- simdataSub[, "indB"] covmat <- simdataSub[, 6:10] fac2x2analyze(time, event, indA, indB, covmat, alpha = 0.05, niter = 5) # $loghrA # [1] 0.05613844 # $seA # [1] 0.4531521 # $ZstatA # [1] 0.1238843 # $pvalA # [1] 0.9014069 # $hrA # [1] 1.057744 # $ciA # [1] 0.4351608 2.5710556 # $loghra # [1] 0.1987329 # $sea # [1] 0.6805458 # $Zstata # [1] 0.2920198 # $pvala # [1] 0.7702714 # $hra # [1] 1.219856 # $cia # [1] 0.3213781 4.6302116 # $loghrab # [1] 0.2864932 # $seab # [1] 0.6762458 # $Zstatab # [1] 0.4236525 # $pvalab # [1] 0.6718193 # $hrab # [1] 1.331749 # $ciab # [1] 0.3538265 5.0125010 # $critPA2A # [1] -2.129 # $sigPA2A # [1] 0.03325426 # $critPA2ab # [1] -2.299 # $sigPA2ab # [1] 0.02150494 # $result23 # [1] "accept overall A" "accept simple AB" # $critEA3 # [1] -2.338 # $sigEA3 # [1] 0.01938725 # $result13 # [1] "accept overall A" "accept simple A" "accept simple AB" # $critEA2 # [1] -2.216 # $sigEA2 # [1] 0.0266915 # $result12 # [1] "accept simple A" "accept simple AB" # $corAa # [1] 0.6123399 # $corAab # [1] 0.5675396 # $coraab # [1] 0.4642737
# First load the simulated data variables. The "simdataSub" file is # a 100-by-9 matrix which is loaded with the factorial2x2 package. time <- simdataSub[, "time"] event <- simdataSub[, "event"] indA <- simdataSub[, "indA"] indB <- simdataSub[, "indB"] covmat <- simdataSub[, 6:10] fac2x2analyze(time, event, indA, indB, covmat, alpha = 0.05, niter = 5) # $loghrA # [1] 0.05613844 # $seA # [1] 0.4531521 # $ZstatA # [1] 0.1238843 # $pvalA # [1] 0.9014069 # $hrA # [1] 1.057744 # $ciA # [1] 0.4351608 2.5710556 # $loghra # [1] 0.1987329 # $sea # [1] 0.6805458 # $Zstata # [1] 0.2920198 # $pvala # [1] 0.7702714 # $hra # [1] 1.219856 # $cia # [1] 0.3213781 4.6302116 # $loghrab # [1] 0.2864932 # $seab # [1] 0.6762458 # $Zstatab # [1] 0.4236525 # $pvalab # [1] 0.6718193 # $hrab # [1] 1.331749 # $ciab # [1] 0.3538265 5.0125010 # $critPA2A # [1] -2.129 # $sigPA2A # [1] 0.03325426 # $critPA2ab # [1] -2.299 # $sigPA2ab # [1] 0.02150494 # $result23 # [1] "accept overall A" "accept simple AB" # $critEA3 # [1] -2.338 # $sigEA3 # [1] 0.01938725 # $result13 # [1] "accept overall A" "accept simple A" "accept simple AB" # $critEA2 # [1] -2.216 # $sigEA2 # [1] 0.0266915 # $result12 # [1] "accept simple A" "accept simple AB" # $corAa # [1] 0.6123399 # $corAab # [1] 0.5675396 # $coraab # [1] 0.4642737
Power for the Equal Allocation 3, Proportional Allocation 2, and Equal Allocation 2 procedures.
fac2x2design( n, rateC, hrA, hrB, hrAB, mincens, maxcens, dig = 2, alpha = 0.05, niter = 5, abseps = 0.001, corAa = 1/sqrt(2), corAab = 1/sqrt(2), coraab = 1/2 )
fac2x2design( n, rateC, hrA, hrB, hrAB, mincens, maxcens, dig = 2, alpha = 0.05, niter = 5, abseps = 0.001, corAa = 1/sqrt(2), corAab = 1/sqrt(2), coraab = 1/2 )
n |
total sample size |
rateC |
group C one year event rate |
hrA |
group A to group C hazard ratio |
hrB |
group B to group C hazard ratio |
hrAB |
group AB to group C hazard ratio |
mincens |
minimum censoring time |
maxcens |
maximum censoring time |
dig |
number of decimal places to |
alpha |
two-sided significance level |
niter |
number of times we call |
abseps |
|
corAa |
correlation between the overall A and simple A log hazard ratio estimates |
corAab |
correlation between the overall A and simple AB log hazard ratio estimates |
coraab |
correlation between the simple A and simple AB log hazard ratio estimates |
events |
expected number of events |
evtprob |
event probabilities for the C, A, B, and AB groups, respectively |
powerEA3overallA |
Equal Allocation 3's power to detect the overall A effect |
powerEA3simpleA |
Equal Allocation 3's power to detect the simple A effect |
powerEA3simpleAB |
Equal Allocation 3's power to detect the simple AB effect |
powerEA3anyA |
Equal Allocation 3's power to detect the simple A or AB effects |
powerPA2overallA |
Proportional Allocation 2's power to detect the overall A effect |
powerPA2simpleAB |
Proportional Allocation 2's power to detect the simple AB effect |
powerEA2simpleA |
Equal Allocation 2's power to detect the simple A effect |
powerEA2simpleAB |
Equal Allocation 2's power to detect the simple AB effect |
powerA |
power to detect the overall A effect at the two-sided |
powerB |
power to detect the overall B effect at the two-sided |
Leifer, E.S., Troendle, J.F., Kolecki, A., Follmann, D. Joint testing of overall and simple effect for the two-by-two factorial design. (2019). Submitted.
Slud, E.V. Analysis of factorial survival experiments. Biometrics. 1994; 50: 25-38.
eventProb
, crit2x2
, lgrkPower
strLgrkPower
, powerEA3
, powerPA2
,
powerEA2
# Corresponds to scenario 4 in Table 2 from Leifer, Troendle, et al. (2019). n <- 4600 rateC <- 0.0445 hrA <- 0.80 hrB <- 0.80 hrAB <- 0.72 mincens <- 4.0 maxcens <- 8.4 fac2x2design(n, rateC, hrA, hrB, hrAB, mincens, maxcens, dig = 2, alpha = 0.05, niter = 1) # $events # [1] 954.8738 # $evtprob # probC probA probB probAB # 0.2446365 0.2012540 0.2012540 0.1831806 # $powerEA3overallA # [1] 0.5861992 # $powerEA3simpleA # [1] 0.5817954 # $powerEA3simplAB # [1] 0.9071236 # $powerEA3anyA # [1] 0.7060777 # $powerPA2overallA # [1] 0.6582819 # $powerPA2simpleAB # [1] 0.9197286 # $powerEA2simpleA # [1] 0.6203837 # # $powerEA2simpleAB # [1] 0.9226679 # $powerA # [1] 0.7182932 # $powerB # [1] 0.7182932
# Corresponds to scenario 4 in Table 2 from Leifer, Troendle, et al. (2019). n <- 4600 rateC <- 0.0445 hrA <- 0.80 hrB <- 0.80 hrAB <- 0.72 mincens <- 4.0 maxcens <- 8.4 fac2x2design(n, rateC, hrA, hrB, hrAB, mincens, maxcens, dig = 2, alpha = 0.05, niter = 1) # $events # [1] 954.8738 # $evtprob # probC probA probB probAB # 0.2446365 0.2012540 0.2012540 0.1831806 # $powerEA3overallA # [1] 0.5861992 # $powerEA3simpleA # [1] 0.5817954 # $powerEA3simplAB # [1] 0.9071236 # $powerEA3anyA # [1] 0.7060777 # $powerPA2overallA # [1] 0.6582819 # $powerPA2simpleAB # [1] 0.9197286 # $powerEA2simpleA # [1] 0.6203837 # # $powerEA2simpleAB # [1] 0.9226679 # $powerA # [1] 0.7182932 # $powerB # [1] 0.7182932
Computes the power for the unstratified (ordinary) logrank statistic for two group comparison.
lgrkPower(hr, nevent, alpha = 0.05, rprob = 0.5)
lgrkPower(hr, nevent, alpha = 0.05, rprob = 0.5)
hr |
hazard ratio |
nevent |
expected number of events |
alpha |
two-sided significance level |
rprob |
randomization probability |
Uses the formula at the bottom of p.317 from Schoenfeld (Biometrika, 1981) where the beta should be 1 - beta. The formula is modified to assume that values of the hazard ratio less than 1 correspond to treatment efficacy. We do this because we only want to include the probability of rejecting the null in favor of efficacy, not inferiority as well.
power |
logrank power |
Eric Leifer, James Troendle
Schoenfeld, D. The asymptotic properties of nonparametric tests for comparing survival distributions. Biometrika. 1981; 68: 316-319.
hr <- 0.5 nevent <- 98 lgrkPower(hr, nevent, alpha = 0.05, rprob = 0.5) # $power # [1] 0.9293463
hr <- 0.5 nevent <- 98 lgrkPower(hr, nevent, alpha = 0.05, rprob = 0.5) # $power # [1] 0.9293463
Computes the Equal Allocation 2's procedure power to detect the simple A effect and the simple AB effect, respectively.
powerEA2(n, hrA, hrAB, probA_C, probAB_C, crit12)
powerEA2(n, hrA, hrAB, probA_C, probAB_C, crit12)
n |
total subjects with n/4 subjects in each of the C, A, B, and AB groups |
hrA |
group A to group C hazard ratio; |
hrAB |
group AB to group C hazard ratio; |
probA_C |
event probability averaged across the A and C groups |
probAB_C |
event probability averaged across the AB and C groups |
crit12 |
logrank statistic critical value for both the simple A and simple AB effects |
For a 2-by-2 factorial design, this function computes
the probability that either the simple A, respectively, simple AB logrank statistics
reject their null hypotheses using a Dunnett-corrected crit12
critical value.
When the two-sided familywise type I error is 0.05, we may use
crit2x2
to compute crit12
= -2.22 which corresponds
to a 0.0264 two-sided significance level. This is described in
Leifer, Troendle, et al. (2020).
powerEA2simpleA |
power to detect the simple A effect |
powerEA2simpleAB |
power to detect the simple AB effect |
Leifer, E.S., Troendle, J.F., Kolecki, A., Follmann, D. Joint testing of overall and simple effect for the two-by-two factorial design. (2020). Submitted.
Lin, D-Y., Gong, J., Gallo, P., et al. Simultaneous inference on treatment effects in survival studies with factorial designs. Biometrics. 2016; 72: 1078-1085.
Slud, E.V. Analysis of factorial survival experiments. Biometrics. 1994; 50: 25-38.
crit2x2
, lgrkPower
# Corresponds to scenario 4 in Table 2 from Leifer, Troendle, et al. (2020). rateC <- 0.0445 # one-year C group event rate hrA <- 0.80 hrB <- 0.80 hrAB <- 0.72 mincens <- 4.0 maxcens <- 8.4 evtprob <- eventProb(rateC, hrA, hrB, hrAB, mincens, maxcens) probA_C <- evtprob$probA_C probAB_C <- evtprob$probAB_C corAa <- 1/sqrt(2) corAab <- 1/sqrt(2) coraab <- 1/2 dig <- 2 alpha <- 0.05 critEA2 <- crit2x2(corAa, corAab, coraab, dig, alpha)$critEA2 n <- 4600 powerEA2(n, hrA, hrAB, probA_C, probAB_C, critEA2) # $powerEA2simpleA # [1] 0.6203837 # $powerEA2simpleAB # [1] 0.9226679
# Corresponds to scenario 4 in Table 2 from Leifer, Troendle, et al. (2020). rateC <- 0.0445 # one-year C group event rate hrA <- 0.80 hrB <- 0.80 hrAB <- 0.72 mincens <- 4.0 maxcens <- 8.4 evtprob <- eventProb(rateC, hrA, hrB, hrAB, mincens, maxcens) probA_C <- evtprob$probA_C probAB_C <- evtprob$probAB_C corAa <- 1/sqrt(2) corAab <- 1/sqrt(2) coraab <- 1/2 dig <- 2 alpha <- 0.05 critEA2 <- crit2x2(corAa, corAab, coraab, dig, alpha)$critEA2 n <- 4600 powerEA2(n, hrA, hrAB, probA_C, probAB_C, critEA2) # $powerEA2simpleA # [1] 0.6203837 # $powerEA2simpleAB # [1] 0.9226679
Computes the Equal Allocation 3 procedure's power to detect the overall A effect, the simple A effect, or the simple AB effect, respectively.
powerEA3( n, hrA, hrB, hrAB, avgprob, probA_C, probAB_C, critEA3, dig, cormat12 = matrix(c(1, sqrt(0.5), sqrt(0.5), 1), byrow = T, nrow = 2), niter = 5, abseps = 0.001 )
powerEA3( n, hrA, hrB, hrAB, avgprob, probA_C, probAB_C, critEA3, dig, cormat12 = matrix(c(1, sqrt(0.5), sqrt(0.5), 1), byrow = T, nrow = 2), niter = 5, abseps = 0.001 )
n |
total subjects with n/4 subjects in each of the C, A, B, and AB groups |
hrA |
group A to group C hazard ratio; |
hrB |
group B to group C hazard ratio; |
hrAB |
group AB to group C hazard ratio; |
avgprob |
event probability averaged across the C, A, B, and AB groups |
probA_C |
event probability averaged across the A and C groups |
probAB_C |
event probability averaged across the AB and C groups |
critEA3 |
rejection critical value for the overall A, simple A, and simple AB logrank statistics |
dig |
number of decimal places to |
cormat12 |
asymptotic correlation matrix for the overall A and simple A, respectively, simple AB logrank statistics |
niter |
number of times we call |
abseps |
|
For a 2-by-2 factorial design, this function computes
the probability that either the overall A
or the simple A or the simple AB logrank statistics
reject their null hypotheses at the Dunnet-corrected
critEA3
critical value. As described in Leifer, Troendle, et al. (2019),
the critEA3
= -2.32 critical value
corresponds to controlling the famiywise error of the Equal Allocation 3 procedure at the
two-sided 0.05 significance level.
The critical value -2.32 may be computed using the crit2x2
function.
The pmvnorm
function from the mvtnorm
package is used to calculate
the power for simultaneously detecting the overall and simple A effects.
This is used to compute the power for detecting the overall A and/or simple A effects,
which is computed as the sum of the powers for each of the effects minus the
power for simultaneously detecting both effects.
Since the power for simultaneously detecting both effects involves bivariate
normal integration over an unbounded region in R^2, pmvnorm
uses a random seed for these computations. Note that cRAN suggested
we not include the random seed as an argument in this function. To smooth out the
randomness, pmvnorm
is called niter
times and
the average value over the niter
calls is taken to be those powers.
powerEA3overallA |
power to detect the overall A effect |
powerEA3simpleA |
power to detect the simple A effect |
powerEA3simpleAB |
power to detect the simple AB effect |
powerEA3anyA |
power to detect either the overall A or simple A effects |
Leifer, E.S., Troendle, J.F., Kolecki, A., Follmann, D. Joint testing of overall and simple effect for the two-by-two factorial design. (2020). Submitted.
Lin, D-Y., Gong, J., Gallo, P., et al. Simultaneous inference on treatment effects in survival studies with factorial designs. Biometrics. 2016; 72: 1078-1085.
Slud, E.V. Analysis of factorial survival experiments. Biometrics. 1994; 50: 25-38.
crit2x2
, lgrkPower
, strLgrkPower
, pmvnorm
# Corresponds to scenario 5 in Table 2 from Leifer, Troendle, et al. (2020). rateC <- 0.0445 hrA <- 0.80 hrB <- 0.80 hrAB <- 0.72 mincens <- 4.0 maxcens <- 8.4 evtprob <- eventProb(rateC, hrA, hrB, hrAB, mincens, maxcens) avgprob <- evtprob$avgprob probAB_C <- evtprob$probAB_C probA_C <- evtprob$probA_C dig <- 2 alpha <- 0.05 corAa <- 1/sqrt(2) corAab <- 1/sqrt(2) coraab <- 1/2 critEA3 <- crit2x2(corAa, corAab, coraab, dig, alpha)$critEA3 n <- 4600 powerEA3(n, hrA, hrB, hrAB, avgprob, probA_C, probAB_C, critEA3, dig, cormat12 = matrix(c(1, sqrt(0.5), sqrt(0.5), 1), byrow = TRUE, nrow = 2), niter = 1, abseps = 1e-03) # $powerEA3overallA # [1] 0.5861992 # $powerEA3simpleA # [1] 0.5817954 # $powerAB # [1] 0.9071236 # $powerEA3anyA # [1] 0.7060777
# Corresponds to scenario 5 in Table 2 from Leifer, Troendle, et al. (2020). rateC <- 0.0445 hrA <- 0.80 hrB <- 0.80 hrAB <- 0.72 mincens <- 4.0 maxcens <- 8.4 evtprob <- eventProb(rateC, hrA, hrB, hrAB, mincens, maxcens) avgprob <- evtprob$avgprob probAB_C <- evtprob$probAB_C probA_C <- evtprob$probA_C dig <- 2 alpha <- 0.05 corAa <- 1/sqrt(2) corAab <- 1/sqrt(2) coraab <- 1/2 critEA3 <- crit2x2(corAa, corAab, coraab, dig, alpha)$critEA3 n <- 4600 powerEA3(n, hrA, hrB, hrAB, avgprob, probA_C, probAB_C, critEA3, dig, cormat12 = matrix(c(1, sqrt(0.5), sqrt(0.5), 1), byrow = TRUE, nrow = 2), niter = 1, abseps = 1e-03) # $powerEA3overallA # [1] 0.5861992 # $powerEA3simpleA # [1] 0.5817954 # $powerAB # [1] 0.9071236 # $powerEA3anyA # [1] 0.7060777
Computes the Proportional Allocation 2 procedure's power to detect the overall A effect or the simple AB effect, respectively.
powerPA2(n, hrA, hrB, hrAB, avgprob, probAB_C, critPA2A, critPA2ab, dig)
powerPA2(n, hrA, hrB, hrAB, avgprob, probAB_C, critPA2A, critPA2ab, dig)
n |
total subjects with n/4 subjects in each of the C, A, B, and AB groups |
hrA |
group A to group C hazard ratio; |
hrB |
group B to group C hazard ratio; |
hrAB |
group AB to group C hazard ratio; |
avgprob |
event probability averaged across the C, A, B, and AB groups |
probAB_C |
event probability averaged across the AB and C groups |
critPA2A |
rejection critical value for the overall A stratified logrank statistic |
critPA2ab |
rejection critical value for the simple AB ordinary logrank statistic |
dig |
number of decimal places to which we |
The Proportional Allocation 2 procedure uses a two-sided
2/3 * alpha significance level to test the overall A effect and the
remaining Dunnett-corrected type 1 error to thest the simple AB effect.
When the familywise error is alpha = 0.05, this corresponds to a
critical value critPA2A
= -2.13.
Then crit2x2
is used to compute a critical value
critPA2ab
= -2.24 to test the simple AB effect. This corresponds to
a two-sided 0.0251 significance level. This controls the
asymptotic familywise type I error for the two hypothesis tests at the
two-sided 0.05 level. This is because of the 1/sqrt(2)
asymptotic
correlation between the logrank test statistics for the overall A
and simple AB effects (Slud, 1994). The overall A effect's significance
level 2/3 * 0.05 is prespecified and the simple AB effect's significance
level 0.0251 is computed using crit2x2
.
powerPA2overallA |
power to detect the overall A effect |
powerPA2simpleAB |
power to detect the simple AB effect |
Eric Leifer, James Troendle
Leifer, E.S., Troendle, J.F., Kolecki, A., Follmann, D. Joint testing of overall and simple effect for the two-by-two factorial design. (2020). Submitted.
Lin, D-Y., Gong, J., Gallo, P., et al. Simultaneous inference on treatment effects in survival studies with factorial designs. Biometrics. 2016; 72: 1078-1085.
Slud, E.V. Analysis of factorial survival experiments. Biometrics. 1994; 50: 25-38.
crit2x2
, eventProb
, lgrkPower
, strLgrkPower
# Corresponds to scenario 4 in Table 2 from Leifer, Troendle, et al. (2020). rateC <- 0.0445 # one-year C group event rate hrA <- 0.80 hrB <- 0.80 hrAB <- 0.72 mincens <- 4.0 maxcens <- 8.4 evtprob <- eventProb(rateC, hrA, hrB, hrAB, mincens, maxcens) avgprob <- evtprob$avgprob probAB_C <- evtprob$probAB_C dig <- 2 alpha <- 0.05 corAa <- 1/sqrt(2) corAab <- 1/sqrt(2) coraab <- 1/2 critvals <- crit2x2(corAa, corAab, coraab, dig, alpha) critPA2A <- critvals$critPA2A critPA2ab <- critvals$critPA2ab n <- 4600 powerPA2(n, hrA, hrB, hrAB, avgprob, probAB_C, critPA2A, critPA2ab, dig) # $powerPA2overallA # [1] 0.6582819 # $powerPA2simpleAB # [1] 0.9197286
# Corresponds to scenario 4 in Table 2 from Leifer, Troendle, et al. (2020). rateC <- 0.0445 # one-year C group event rate hrA <- 0.80 hrB <- 0.80 hrAB <- 0.72 mincens <- 4.0 maxcens <- 8.4 evtprob <- eventProb(rateC, hrA, hrB, hrAB, mincens, maxcens) avgprob <- evtprob$avgprob probAB_C <- evtprob$probAB_C dig <- 2 alpha <- 0.05 corAa <- 1/sqrt(2) corAab <- 1/sqrt(2) coraab <- 1/2 critvals <- crit2x2(corAa, corAab, coraab, dig, alpha) critPA2A <- critvals$critPA2A critPA2ab <- critvals$critPA2ab n <- 4600 powerPA2(n, hrA, hrB, hrAB, avgprob, probAB_C, critPA2A, critPA2ab, dig) # $powerPA2overallA # [1] 0.6582819 # $powerPA2simpleAB # [1] 0.9197286
Rounds a negative number to the nearest, more negative number to a specified decimal place.
roundDown(x, dig)
roundDown(x, dig)
x |
number to be rounded |
dig |
number of decimal places to be rounded |
roundDown
is used to
round a negative Z-statistic critical value, which has (infinitely)
many significant digits, to the nearest dig
decimal place
which is more extreme
than the critical value itself. This is done to preserve the
desired type I error level.
roundDown(-1.95456, 2) # [1] -1.96
roundDown(-1.95456, 2) # [1] -1.96
A dataset mimicking data that might be obtained from a
two-by-two factorial clinical trial. It is the first 100 rows
of the data set simdata
.
data(simdat)
data(simdat)
A data frame with 100 rows and 10 variables
subjno
subject ID
time
time to event or censoring
event
event indicator (1=event, 0=censoring)
indA
indicator of receiving treatment A (1=yes, 0=no)
indB
indicator of receiving treatment B (1=yes, 0=no)
cvd
history of cardiovascular disease (1=yes, 0=no)
fac2-fac5
indicator variables for the 5 level factor variable
A dataset mimicking data that might be obtained from a two-by-two factorial clinical trial.
data(simdata)
data(simdata)
A data frame with 4600 rows and 10 variables
subjno
subject ID
time
time to event or censoring
event
event indicator (1=event, 0=censoring)
indA
indicator of receiving treatment A (1=yes, 0=no)
indB
indicator of receiving treatment B (1=yes, 0=no)
cvd
history of cardiovascular disease (1=yes, 0=no)
fac2-fac5
indicator variables for the 5 level factor variable
A dataset mimicking data that might be obtained from a
two-by-two factorial clinical trial. It is the first 100 rows
of the data set simdata
.
data(simdataSub)
data(simdataSub)
A data frame with 100 rows and 10 variables
subjno
subject ID
time
time to event or censoring
event
event indicator (1=event, 0=censoring)
indA
indicator of receiving treatment A (1=yes, 0=no)
indB
indicator of receiving treatment B (1=yes, 0=no)
cvd
history of cardiovascular disease (1=yes, 0=no)
fac2-fac5
indicator variables for the 5 level factor variable
Computes the power for the overall treatment A effect based on the stratified logrank test based on Slud (1994).
strLgrkPower(n, hrA, hrB, hrAB, avgprob, dig = 2, alpha = 0.05)
strLgrkPower(n, hrA, hrB, hrAB, avgprob, dig = 2, alpha = 0.05)
n |
total subjects with n/4 subjects in the C, A, B, and AB groups |
hrA |
group A to group C hazard ratio |
hrB |
group B to group C hazard ratio |
hrAB |
group AB to group C hazard ratio |
avgprob |
average event probability across the four groups as calculated by the function eventProb |
dig |
number of decimal places to which we |
alpha |
two-sided significance level |
The roundDown
function is used in conjunction with the dig
argument
to insure that any rounding of the (negative) critical values will be done conservatively to control
the familywise type I error at the desired level.
mean |
logrank mean value |
power |
logrank power |
nevent |
expected number of events |
Eric Leifer, James Troendle
Leifer, E.S., Troendle, J.F., Kolecki, A., Follmann, D. Joint testing of overall and simple effect for the two-by-two factorial design. (2019). Submitted.
Slud, E.V. Analysis of factorial survival experiments. Biometrics. 1994; 50: 25-38.
rateC <- 0.0445 hrA <- 0.80 hrB <- 0.80 hrAB <- 0.72 mincens <- 4.0 maxcens <- 8.4 avgprob <- eventProb(rateC, hrA, hrB, hrAB, mincens, maxcens)$avgprob n <- 4600 strLgrkPower(n, hrA, hrB, hrAB, avgprob, dig = 2, alpha = 0.05) # $mean # [1] -2.537779 # $power # [1] 0.7182932 # $nevent # [1] 954.8738
rateC <- 0.0445 hrA <- 0.80 hrB <- 0.80 hrAB <- 0.72 mincens <- 4.0 maxcens <- 8.4 avgprob <- eventProb(rateC, hrA, hrB, hrAB, mincens, maxcens)$avgprob n <- 4600 strLgrkPower(n, hrA, hrB, hrAB, avgprob, dig = 2, alpha = 0.05) # $mean # [1] -2.537779 # $power # [1] 0.7182932 # $nevent # [1] 954.8738