| Title: | Optimal Two-Stage Designs for Ordered Categorical Outcomes |
|---|---|
| Description: | Functions to design and simulate optimal two-stage randomized controlled trials (RCTs) with ordered categorical outcomes, supporting rank-based tests and group-sequential decision rules. Methods build on classical and modern rank tests and two-stage/Group-Sequential designs, e.g., Park (2025) <doi: 10.1371/journal.pone.0318211>. Please see the package reference manual and vignettes for details. |
| Authors: | Yeonhee Park [aut, cre], Yudi Wang [aut], Zhanpeng Xu [aut] |
| Maintainer: | Yeonhee Park <[email protected]> |
| License: | GPL-3 |
| Version: | 1.0.2 |
| Built: | 2026-06-02 07:22:39 UTC |
| Source: | https://github.com/cran/OptOTrials |
Functions to design and simulate optimal two-stage randomized controlled trials (RCTs) with ordered categorical outcomes, supporting rank-based tests and group-sequential decision rules. Methods build on classical and modern rank tests and two-stage/Group-Sequential designs, e.g., Park (2025) <doi: 10.1371/journal.pone.0318211>. Please see the package reference manual and vignettes for details.
There are several main functoins. Decision_rule_S_1stage, Decision_rule_M_1stage, Decision_rule_W_1stage, ruleF, and ruleFS determine the decision rule for clinical trials. op.1stage, op.F, and op.FS calculate the operating characteristics for clinical trial designs, including type I error, power, and expected sample size, to investigate the performance of the designs.
Yeonhee Park [aut, cre], Yudi Wang [aut], Zhanpeng Xu [aut]
Maintainer: Yeonhee Park <[email protected]>
Park, Y. (2025). Optimal two-stage group sequential designs based on Mann-Whitney-Wilcoxon test. PloS one, 20(2), e0318211.
This is the function to determine the decision rule for a one-stage clinical trial designs based on the Mann-Whitney-Wilcoxon test.
Decision_rule_M_1stage(p1, p2, alpha, beta, lambda = 1)Decision_rule_M_1stage(p1, p2, alpha, beta, lambda = 1)
p1 |
A vector containing the probabilities of the outcome falling into each level of the control arm. |
p2 |
A vector containging the probabilities of the outcome falling into each level of the control arm. |
alpha |
Target type I error rate. |
beta |
Target type II error rate. |
lambda |
The ratio of sample sizes between the experimental and control groups, defined as sample size (experimental): sample size (control) = lambda:1. The default value is 1. |
n2 |
The total sample size at the final analysis including both the control and experimental groups. |
t2 |
The threshold of the test statistic at the analysis. |
Park, Y. (2025). Optimal two-stage group sequential designs based on Mann-Whitney-Wilcoxon test. PloS one, 20(2), e0318211.
alpha = 0.05; beta = 0.2; p1 = c(0.2, 0.5, 0.2, 0.1) p2 = c(0.4, 0.3, 0.2, 0.1) Decision_rule_M_1stage(p1, p2, alpha, beta, lambda = 1)alpha = 0.05; beta = 0.2; p1 = c(0.2, 0.5, 0.2, 0.1) p2 = c(0.4, 0.3, 0.2, 0.1) Decision_rule_M_1stage(p1, p2, alpha, beta, lambda = 1)
This is to determine the decision rule for a two-stage design based on the Mann-Whitney-Wilcoxon test with the specified values of alpha1 and beta1.
Decision_rule_M.F(p1, p2, alpha1, beta1, alpha, beta, lambda = 1)Decision_rule_M.F(p1, p2, alpha1, beta1, alpha, beta, lambda = 1)
p1 |
A vector containing the probabilities of the outcome falling into each level of the control arm. |
p2 |
A vector containging the probabilities of the outcome falling into each level of the control arm. |
alpha1 |
The parameter used to define futility monitoring. Under the null hypothesis, 1 - alpha1 corresponds to the probability of stopping for futility at the interim analysis. |
beta1 |
The probability of stopping for futility at the interim analysis when the alternative hypothesis is true. |
alpha |
Target type I error rate. |
beta |
Target type II error rate. |
lambda |
The ratio of sample sizes between the experimental and control groups, defined as sample size (experimental): sample size (control) = lambda:1. The default value is 1. |
n1 |
The total sample size of the control and experimental groups required at the 1st analysis. |
t1 |
The threshold of the test statistic at the 1st analysis. |
n2 |
The cumulative total sample size of the control and experimental groups required at the 2nd analysis. |
t2 |
The threshold of the test statistic at the 2nd analysis. |
Park, Y. (2025). Optimal two-stage group sequential designs based on Mann-Whitney-Wilcoxon test. PloS one, 20(2), e0318211.
alpha = 0.05; beta = 0.2; p1 = c(0.2, 0.5, 0.2, 0.1) p2 = c(0.4, 0.3, 0.2, 0.1) alpha1 <- 0.2 beta1 <- 0.1 Decision_rule_M.F(p1, p2, alpha1, beta1, alpha, beta, lambda = 1)alpha = 0.05; beta = 0.2; p1 = c(0.2, 0.5, 0.2, 0.1) p2 = c(0.4, 0.3, 0.2, 0.1) alpha1 <- 0.2 beta1 <- 0.1 Decision_rule_M.F(p1, p2, alpha1, beta1, alpha, beta, lambda = 1)
This is the function to determine the decision rule for the FS design based on the Mann-Whitney-Wilcoxon test with the specified values of alpha1, alpha2, and beta1.
Decision_rule_M.FS(p1, p2, alpha1, alpha2, beta1, alpha, beta, lambda = 1)Decision_rule_M.FS(p1, p2, alpha1, alpha2, beta1, alpha, beta, lambda = 1)
p1 |
A vector containing the probabilities of the outcome falling into each level of the control arm. |
p2 |
A vector containging the probabilities of the outcome falling into each level of the control arm. |
alpha1 |
The parameter used to define futility monitoring. Under the null hypothesis, 1 - alpha1 corresponds to the probability of stopping for futility at the interim analysis. |
alpha2 |
The probability of stopping for superiority at the interim analysis when the null hypothesis is true. |
beta1 |
The probability of stopping for futility at the interim analysis when the alternative hypothesis is true. |
alpha |
Target type I error rate. |
beta |
Target type II error rate. |
lambda |
The ratio of sample sizes between the experimental and control groups, defined as sample size (experimental): sample size (control) = lambda:1. The default value is 1. |
n1 |
The total sample size of the control and experimental groups required at the 1st analysis. |
t1l |
The lower threshold of the test statistic at the 1st analysis. |
t1u |
The upper threshold of the test statistic at the 1st analysis. |
n2 |
The cumulative total sample size of the control and experimental groups required at the 2nd analysis. |
t2 |
The threshold of the test statistic at the 2nd analysis. |
beta2 |
Under the null hypothesis, 1 - beta2 denotes the probability of stopping for superiority at the interim analysis. |
Park, Y. (2025). Optimal two-stage group sequential designs based on Mann-Whitney-Wilcoxon test. PloS one, 20(2), e0318211.
alpha = 0.05; beta = 0.2; p1 = c(0.2, 0.5, 0.2, 0.1) p2 = c(0.4, 0.3, 0.2, 0.1) alpha1 <- 0.2 alpha2 <- 0.025 beta1 <- 0.1 Decision_rule_M.FS(p1, p2, alpha1, alpha2, beta1, alpha, beta, lambda = 1)alpha = 0.05; beta = 0.2; p1 = c(0.2, 0.5, 0.2, 0.1) p2 = c(0.4, 0.3, 0.2, 0.1) alpha1 <- 0.2 alpha2 <- 0.025 beta1 <- 0.1 Decision_rule_M.FS(p1, p2, alpha1, alpha2, beta1, alpha, beta, lambda = 1)
This is the function to determine the decision rule for a one-stage clinical trial designs based on the score test.
Decision_rule_S_1stage(p1, p2, alpha, beta, lambda = 1)Decision_rule_S_1stage(p1, p2, alpha, beta, lambda = 1)
p1 |
A vector containing the probabilities of the outcome falling into each level of the control arm. |
p2 |
A vector containging the probabilities of the outcome falling into each level of the control arm. |
alpha |
Target type I error rate. |
beta |
Target type II error rate. |
lambda |
The ratio of sample sizes between the experimental and control groups, defined as sample size (experimental): sample size (control) = lambda:1. The default value is 1. |
n2 |
The total sample size at the final analysis including both the control and experimental groups. |
t2 |
The threshold of the test statistic at the analysis. |
Park, Y. (2025). Optimal two-stage group sequential designs based on Mann-Whitney-Wilcoxon test. PloS one, 20(2), e0318211.
alpha = 0.05; beta = 0.2; or = 3.06 p1 = c(0.075, 0.182, 0.319, 0.243, 0.015, 0.166) # control prob p2 = p2_fun(p1, log(or)) # experimental prob p2 Decision_rule_S_1stage(p1, p2, alpha, beta, lambda = 1)alpha = 0.05; beta = 0.2; or = 3.06 p1 = c(0.075, 0.182, 0.319, 0.243, 0.015, 0.166) # control prob p2 = p2_fun(p1, log(or)) # experimental prob p2 Decision_rule_S_1stage(p1, p2, alpha, beta, lambda = 1)
This is to determine the decision rule for a two-stage design based on the score test with the specified values of alpha1 and beta1.
Decision_rule_S.F(p1, p2, alpha1, beta1, alpha, beta, lambda = 1)Decision_rule_S.F(p1, p2, alpha1, beta1, alpha, beta, lambda = 1)
p1 |
A vector containing the probabilities of the outcome falling into each level of the control arm. |
p2 |
A vector containging the probabilities of the outcome falling into each level of the control arm. |
alpha1 |
The parameter used to define futility monitoring. Under the null hypothesis, 1 - alpha1 corresponds to the probability of stopping for futility at the interim analysis. |
beta1 |
The probability of stopping for futility at the interim analysis when the alternative hypothesis is true. |
alpha |
Target type I error rate. |
beta |
Target type II error rate. |
lambda |
The ratio of sample sizes between the experimental and control groups, defined as sample size (experimental): sample size (control) = lambda:1. The default value is 1. |
n1 |
The total sample size of the control and experimental groups required at the 1st analysis. |
t1 |
The threshold of the test statistic at the 1st analysis. |
n2 |
The cumulative total sample size of the control and experimental groups required at the 2nd analysis. |
t2 |
The threshold of the test statistic at the 2nd analysis. |
alpha = 0.05; beta = 0.2; or = 3.06 p1 = c(0.075, 0.182, 0.319, 0.243, 0.015, 0.166) # control prob p2 = p2_fun(p1, log(or)) # experimental prob p2 alpha1 <- 0.2 beta1 <- 0.1 Decision_rule_S.F(p1, p2, alpha1, beta1, alpha, beta, lambda = 1)alpha = 0.05; beta = 0.2; or = 3.06 p1 = c(0.075, 0.182, 0.319, 0.243, 0.015, 0.166) # control prob p2 = p2_fun(p1, log(or)) # experimental prob p2 alpha1 <- 0.2 beta1 <- 0.1 Decision_rule_S.F(p1, p2, alpha1, beta1, alpha, beta, lambda = 1)
This is the function to determine the decision rule for the FS design based on the score test with the specified values of alpha1, alpha2, and beta1.
Decision_rule_S.FS(p1, p2, alpha1, alpha2, beta1, alpha, beta, lambda = 1)Decision_rule_S.FS(p1, p2, alpha1, alpha2, beta1, alpha, beta, lambda = 1)
p1 |
A vector containing the probabilities of the outcome falling into each level of the control arm. |
p2 |
A vector containging the probabilities of the outcome falling into each level of the control arm. |
alpha1 |
The parameter used to define futility monitoring. Under the null hypothesis, 1 - alpha1 corresponds to the probability of stopping for futility at the interim analysis. |
alpha2 |
The probability of stopping for superiority at the interim analysis when the null hypothesis is true. |
beta1 |
The probability of stopping for futility at the interim analysis when the alternative hypothesis is true. |
alpha |
Target type I error rate. |
beta |
Target type II error rate. |
lambda |
The ratio of sample sizes between the experimental and control groups, defined as sample size (experimental): sample size (control) = lambda:1. The default value is 1. |
n1 |
The total sample size of the control and experimental groups required at the 1st analysis. |
t1l |
The lower threshold of the test statistic at the 1st analysis. |
t1u |
The upper threshold of the test statistic at the 1st analysis. |
n2 |
The cumulative total sample size of the control and experimental groups required at the 2nd analysis. |
t2 |
The threshold of the test statistic at the 2nd analysis. |
beta2 |
Under the null hypothesis, 1 - beta2 denotes the probability of stopping for superiority at the interim analysis. |
alpha = 0.05; beta = 0.2; or = 3.06 p1 = c(0.075, 0.182, 0.319, 0.243, 0.015, 0.166) # control prob p2 = p2_fun(p1, log(or)) # experimental prob p2 alpha1 <- 0.2 alpha2 <- 0.025 beta1 <- 0.1 Decision_rule_S.FS(p1, p2, alpha1, alpha2, beta1, alpha, beta, lambda = 1)alpha = 0.05; beta = 0.2; or = 3.06 p1 = c(0.075, 0.182, 0.319, 0.243, 0.015, 0.166) # control prob p2 = p2_fun(p1, log(or)) # experimental prob p2 alpha1 <- 0.2 alpha2 <- 0.025 beta1 <- 0.1 Decision_rule_S.FS(p1, p2, alpha1, alpha2, beta1, alpha, beta, lambda = 1)
This is the function to determine the decision rule for a one-stage clinical trial designs based on the Win Odds test.
Decision_rule_W_1stage(p1, p2, alpha, beta, lambda = 1)Decision_rule_W_1stage(p1, p2, alpha, beta, lambda = 1)
p1 |
A vector containing the probabilities of the outcome falling into each level of the control arm. |
p2 |
A vector containging the probabilities of the outcome falling into each level of the control arm. |
alpha |
Target type I error rate. |
beta |
Target type II error rate. |
lambda |
The ratio of sample sizes between the experimental and control groups, defined as sample size (experimental): sample size (control) = lambda:1. The default value is 1. |
n2 |
The total sample size at the final analysis including both the control and experimental groups. |
t2 |
The threshold of the test statistic at the analysis. |
alpha = 0.05; beta = 0.2; p1 = c(0.2, 0.5, 0.2, 0.1) p2 = c(0.4, 0.3, 0.2, 0.1) Decision_rule_W_1stage(p1, p2, alpha, beta, lambda = 1)alpha = 0.05; beta = 0.2; p1 = c(0.2, 0.5, 0.2, 0.1) p2 = c(0.4, 0.3, 0.2, 0.1) Decision_rule_W_1stage(p1, p2, alpha, beta, lambda = 1)
This is to determine the decision rule for a two-stage design based on the Win Odds test with the specified values of alpha1 and beta1.
Decision_rule_W.F(p1, p2, alpha1, beta1, alpha, beta, lambda = 1)Decision_rule_W.F(p1, p2, alpha1, beta1, alpha, beta, lambda = 1)
p1 |
A vector containing the probabilities of the outcome falling into each level of the control arm. |
p2 |
A vector containging the probabilities of the outcome falling into each level of the control arm. |
alpha1 |
The parameter used to define futility monitoring. Under the null hypothesis, 1 - alpha1 corresponds to the probability of stopping for futility at the interim analysis. |
beta1 |
The probability of stopping for futility at the interim analysis when the alternative hypothesis is true. |
alpha |
Target type I error rate. |
beta |
Target type II error rate. |
lambda |
The ratio of sample sizes between the experimental and control groups, defined as sample size (experimental): sample size (control) = lambda:1. The default value is 1. |
n1 |
The total sample size of the control and experimental groups required at the 1st analysis. |
t1 |
The threshold of the test statistic at the 1st analysis. |
n2 |
The cumulative total sample size of the control and experimental groups required at the 2nd analysis. |
t2 |
The threshold of the test statistic at the 2nd analysis. |
alpha = 0.05; beta = 0.2; p1 = c(0.2, 0.5, 0.2, 0.1) p2 = c(0.4, 0.3, 0.2, 0.1) alpha1 <- 0.2 beta1 <- 0.1 Decision_rule_W.F(p1, p2, alpha1, beta1, alpha, beta, lambda = 1)alpha = 0.05; beta = 0.2; p1 = c(0.2, 0.5, 0.2, 0.1) p2 = c(0.4, 0.3, 0.2, 0.1) alpha1 <- 0.2 beta1 <- 0.1 Decision_rule_W.F(p1, p2, alpha1, beta1, alpha, beta, lambda = 1)
This is the function to determine the decision rule for the FS design based on the Win Odds test with the specified values of alpha1, alpha2, and beta1.
Decision_rule_W.FS(p1, p2, alpha1, alpha2, beta1, alpha, beta, lambda = 1)Decision_rule_W.FS(p1, p2, alpha1, alpha2, beta1, alpha, beta, lambda = 1)
p1 |
A vector containing the probabilities of the outcome falling into each level of the control arm. |
p2 |
A vector containging the probabilities of the outcome falling into each level of the control arm. |
alpha1 |
The parameter used to define futility monitoring. Under the null hypothesis, 1 - alpha1 corresponds to the probability of stopping for futility at the interim analysis. |
alpha2 |
The probability of stopping for superiority at the interim analysis when the null hypothesis is true. |
beta1 |
The probability of stopping for futility at the interim analysis when the alternative hypothesis is true. |
alpha |
Target type I error rate. |
beta |
Target type II error rate. |
lambda |
The ratio of sample sizes between the experimental and control groups, defined as sample size (experimental): sample size (control) = lambda:1. The default value is 1. |
n1 |
The total sample size of the control and experimental groups required at the 1st analysis. |
t1l |
The lower threshold of the test statistic at the 1st analysis. |
t1u |
The upper threshold of the test statistic at the 1st analysis. |
n2 |
The cumulative total sample size of the control and experimental groups required at the 2nd analysis. |
t2 |
The threshold of the test statistic at the 2nd analysis. |
beta2 |
Under the null hypothesis, 1 - beta2 denotes the probability of stopping for superiority at the interim analysis. |
alpha = 0.05; beta = 0.2; p1 = c(0.2, 0.5, 0.2, 0.1) p2 = c(0.4, 0.3, 0.2, 0.1) alpha1 <- 0.2 alpha2 <- 0.025 beta1 <- 0.1 Decision_rule_W.FS(p1, p2, alpha1, alpha2, beta1, alpha, beta, lambda = 1)alpha = 0.05; beta = 0.2; p1 = c(0.2, 0.5, 0.2, 0.1) p2 = c(0.4, 0.3, 0.2, 0.1) alpha1 <- 0.2 alpha2 <- 0.025 beta1 <- 0.1 Decision_rule_W.FS(p1, p2, alpha1, alpha2, beta1, alpha, beta, lambda = 1)
This is the function to calculate the operating characteristics for a one-stage design, including type I error, power, and expected sample size.
op.1stage(alpha, beta, p1, p2, method, n2, t2, nsim = 10000, lambda = 1)op.1stage(alpha, beta, p1, p2, method, n2, t2, nsim = 10000, lambda = 1)
alpha |
Target type I error rate. |
beta |
Target type II error rate. |
p1 |
A vector containing the probabilities of the outcome falling into each level of the control arm. |
p2 |
A vector containging the probabilities of the outcome falling into each level of the control arm. |
method |
"S", "M" or "W", denotes score test, Mann-Whitney-Wilcoxon test and wi n odds test respectively. |
n2 |
The cumulative total sample size of the control and experimental groups required at the 2nd analysis. |
t2 |
The threshold of the test statistic at the 2nd analysis. |
nsim |
The number of simulations. nsim = 10000 by default |
lambda |
The ratio of sample sizes between the experimental and control groups, defined as sample size (experimental): sample size (control) = lambda:1. The default value is 1. |
The probability of wrong decision and the expected total sample size under the true hypothesis.
set.seed(1234) alpha = 0.05; beta = 0.2; p1 = c(0.2, 0.5, 0.2, 0.1) p2 = c(0.4, 0.3, 0.2, 0.1) out <- Decision_rule_W_1stage(p1, p2, alpha, beta, lambda = 1) # report the power and EN_a op.1stage(alpha, beta, p1, p2, method="W", n2=out[1], t2=out[2], nsim = 1000, lambda = 1) # report the overall type I error rate and EN_0 op.1stage(alpha, beta, p1, p1, method="W", n2=out[1], t2=out[2], nsim = 1000, lambda = 1)set.seed(1234) alpha = 0.05; beta = 0.2; p1 = c(0.2, 0.5, 0.2, 0.1) p2 = c(0.4, 0.3, 0.2, 0.1) out <- Decision_rule_W_1stage(p1, p2, alpha, beta, lambda = 1) # report the power and EN_a op.1stage(alpha, beta, p1, p2, method="W", n2=out[1], t2=out[2], nsim = 1000, lambda = 1) # report the overall type I error rate and EN_0 op.1stage(alpha, beta, p1, p1, method="W", n2=out[1], t2=out[2], nsim = 1000, lambda = 1)
This is the function to calculate the operating characteristics for the F design, including type I error, power, and expected sample size.
op.F(alpha, beta, p1, p2, method, n1, t1, n2, t2, nsim = 10000, lambda = 1)op.F(alpha, beta, p1, p2, method, n1, t1, n2, t2, nsim = 10000, lambda = 1)
alpha |
Target type I error rate. |
beta |
Target type II error rate. |
p1 |
A vector containing the probabilities of the outcome falling into each level of the control arm. |
p2 |
A vector containging the probabilities of the outcome falling into each level of the control arm. |
method |
"S", "M" or "W", denotes score test, Mann-Whitney-Wilcoxon test and wi n odds test respectively. |
n1 |
The total sample size of the control and experimental groups required at the 1st analysis. |
t1 |
The threshold of the test statistic at the 1st analysis. |
n2 |
The cumulative total sample size of the control and experimental groups required at the 2nd analysis. |
t2 |
The threshold of the test statistic at the 2nd analysis. |
nsim |
The number of simulations. nsim = 10000 by default |
lambda |
The ratio of sample sizes between the experimental and control groups, defined as sample size (experimental): sample size (control) = lambda:1. The default value is 1. |
The probability of wrong decision and the expected total sample size under the true hypothesis.
set.seed(1234) alpha = 0.05; beta = 0.2; p1 = c(0.2, 0.5, 0.2, 0.1) p2 = c(0.4, 0.3, 0.2, 0.1) alpha1 <- 0.2 beta1 <- 0.1 out <- Decision_rule_W.F(p1, p2, alpha1, beta1, alpha, beta, lambda = 1) # heavier example for illustration (skipped on CRAN timing checkes) # report the power and EN_a op.F(alpha, beta, p1, p2, method="W", n1=out[1], t1=out[2], n2=out[3], t2=out[4], nsim = 10000, lambda = 1) # report the overall type I error rate and EN_0 op.F(alpha, beta, p1, p1, method="W", n1=out[1], t1=out[2], n2=out[3], t2=out[4], nsim = 10000, lambda = 1)set.seed(1234) alpha = 0.05; beta = 0.2; p1 = c(0.2, 0.5, 0.2, 0.1) p2 = c(0.4, 0.3, 0.2, 0.1) alpha1 <- 0.2 beta1 <- 0.1 out <- Decision_rule_W.F(p1, p2, alpha1, beta1, alpha, beta, lambda = 1) # heavier example for illustration (skipped on CRAN timing checkes) # report the power and EN_a op.F(alpha, beta, p1, p2, method="W", n1=out[1], t1=out[2], n2=out[3], t2=out[4], nsim = 10000, lambda = 1) # report the overall type I error rate and EN_0 op.F(alpha, beta, p1, p1, method="W", n1=out[1], t1=out[2], n2=out[3], t2=out[4], nsim = 10000, lambda = 1)
This is the function to calculate the operating characteristics for the FS design, including type I error, power, and expected sample size.
op.FS(alpha, beta, p1, p2, method, n1, t1l, t1u, n2, t2, nsim = 10000, lambda = 1)op.FS(alpha, beta, p1, p2, method, n1, t1l, t1u, n2, t2, nsim = 10000, lambda = 1)
alpha |
Target type I error rate. |
beta |
Target type II error rate. |
p1 |
A vector containing the probabilities of the outcome falling into each level of the control arm. |
p2 |
A vector containging the probabilities of the outcome falling into each level of the control arm. |
method |
"S", "M" or "W", denotes score test, Mann-Whitney-Wilcoxon test and win odds test respectively. |
n1 |
The total sample size of the control and experimental groups required at the 1st analysis. |
t1l |
The lower threshold of the test statistic at the 1st analysis. |
t1u |
The upper threshold of the test statistic at the 1st analysis. |
n2 |
The cumulative total sample size of the control and experimental groups required at the 2nd analysis. |
t2 |
The threshold of the test statistic at the 2nd analysis. |
nsim |
The number of simulations. nsim = 10000 by default |
lambda |
The ratio of sample sizes between the experimental and control groups, defined as sample size (experimental): sample size (control) = lambda:1. The default value is 1. |
The probability of wrong decision and the expected total sample size under the true hypothesis.
set.seed(1234) alpha = 0.05; beta = 0.2; p1 = c(0.2, 0.5, 0.2, 0.1) p2 = c(0.4, 0.3, 0.2, 0.1) alpha1 <- 0.2 alpha2 <- 0.025 beta1 <- 0.1 out <- Decision_rule_W.FS(p1, p2, alpha1, alpha2, beta1, alpha, beta, lambda = 1) # heavier example for illustration (skipped on CRAN timing checkes) # report the power and EN_a op.FS(alpha, beta, p1, p2, method="W", n1=out[1], t1l=out[2], t1u=out[3], n2=out[4], t2=out[5], nsim = 10000, lambda = 1) # report the overall type I error rate and EN_0 op.FS(alpha, beta, p1, p1, method="W", n1=out[1], t1l=out[2], t1u=out[3], n2=out[4], t2=out[5], nsim = 10000, lambda = 1)set.seed(1234) alpha = 0.05; beta = 0.2; p1 = c(0.2, 0.5, 0.2, 0.1) p2 = c(0.4, 0.3, 0.2, 0.1) alpha1 <- 0.2 alpha2 <- 0.025 beta1 <- 0.1 out <- Decision_rule_W.FS(p1, p2, alpha1, alpha2, beta1, alpha, beta, lambda = 1) # heavier example for illustration (skipped on CRAN timing checkes) # report the power and EN_a op.FS(alpha, beta, p1, p2, method="W", n1=out[1], t1l=out[2], t1u=out[3], n2=out[4], t2=out[5], nsim = 10000, lambda = 1) # report the overall type I error rate and EN_0 op.FS(alpha, beta, p1, p1, method="W", n1=out[1], t1l=out[2], t1u=out[3], n2=out[4], t2=out[5], nsim = 10000, lambda = 1)
This is the function to comupute p-, which is required for the Mann-Whitney-Wilcoxon test.
p_minus(p1, p2)p_minus(p1, p2)
p1 |
A vector containing the probabilities of the outcome falling into each level of the control arm. |
p2 |
A vector containging the probabilities of the outcome falling into each level of the control arm. |
The value of p-.
This is the function to comupute p+, which is required for the Mann-Whitney-Wilcoxon test.
p_plus(p1, p2)p_plus(p1, p2)
p1 |
A vector containing the probabilities of the outcome falling into each level of the control arm. |
p2 |
A vector containging the probabilities of the outcome falling into each level of the control arm. |
The value of p+.
This is the function to calculate the probability p2 when p1 and odds ratio are given.
p2_fun(p1, theta)p2_fun(p1, theta)
p1 |
A vector containing the probabilities of the outcome falling into each level of the control arm. |
theta |
The log odds ratio according to expected effect of the experimental treatment. |
A numeric vector representing the expected probability distribution of outcomes across levels for the experimental group.
This is the function to compute and , which are required for the Win Odds test.
pq_fun(p1, p2)pq_fun(p1, p2)
p1 |
A vector containing the probabilities of the outcome falling into each level of the control arm. |
p2 |
A vector containging the probabilities of the outcome falling into each level of the control arm. |
The value of and .
This is the function to check the proportional odds assumption for the score test.
Proportional_odds_assumption(p1, p2)Proportional_odds_assumption(p1, p2)
p1 |
A vector containing the probabilities of the outcome falling into each level of the control arm. |
p2 |
A vector containging the probabilities of the outcome falling into each level of the control arm. |
Indicates whether the proportional odds assumption holds. If the assumption holds, the function returns the log-odds ratio from the score test. If the assumption does not hold, the function returns NA.
This is the function to compute Q or R, which is required for the Mann-Whitney-Wilcoxon test.
QR_fun(p1, p2)QR_fun(p1, p2)
p1 |
A vector containing the probabilities of the outcome falling into each level of the control arm. |
p2 |
A vector containging the probabilities of the outcome falling into each level of the control arm. |
The value of Q or R.
This is the function to determine the decision rule for the F design.
ruleF(alpha, beta, p1, p2, method, criterion, lambda = 1)ruleF(alpha, beta, p1, p2, method, criterion, lambda = 1)
alpha |
Target type I error rate. |
beta |
Target type II error rate. |
p1 |
A vector containing the probabilities of the outcome falling into each level of the control arm. |
p2 |
A vector containging the probabilities of the outcome falling into each level of the control arm. |
method |
"S", "M" or "W", denotes score test, Mann-Whitney-Wilcoxon test and win odds test respectively. |
criterion |
1: minimizing the expected total sample size under the null hypothesis, 2: minimizing the expected total sample size under the alternative hypothesis, 3: minimizing the expected total sample size assuming that Pr(H0) = Pr(Ha), 4: balancing sample sizes of the two stages prioritizing EN0, 5: balancing sample sizes of the two stages prioritizing maximum sample size n2. |
lambda |
The ratio of sample sizes between the experimental and control groups, defined as sample size (experimental): sample size (control) = lambda:1. The default value is 1. |
method |
Statistical test chosen. |
criterion |
Criterion chosen. |
n1 |
The total sample size of the control and experimental groups required at the 1st analysis. |
t1 |
The threshold of the test statistic at the 1st analysis. |
n2 |
The cumulative total sample size of the control and experimental groups required at the 2nd analysis. |
t2 |
The threshold of the test statistic at the 2nd analysis. |
alpha = 0.05; beta = 0.2; p1 = c(0.2, 0.5, 0.2, 0.1) p2 = c(0.4, 0.3, 0.2, 0.1) ruleF(alpha, beta, p1, p2, method="M", criterion="1", lambda = 1)alpha = 0.05; beta = 0.2; p1 = c(0.2, 0.5, 0.2, 0.1) p2 = c(0.4, 0.3, 0.2, 0.1) ruleF(alpha, beta, p1, p2, method="M", criterion="1", lambda = 1)
This is the function to determine the decision rule for the FS design.
ruleFS(alpha, beta, p1, p2, method, criterion, lambda = 1)ruleFS(alpha, beta, p1, p2, method, criterion, lambda = 1)
alpha |
Target type I error rate. |
beta |
Target type II error rate. |
p1 |
A vector containing the probabilities of the outcome falling into each level of the control arm. |
p2 |
A vector containging the probabilities of the outcome falling into each level of the control arm. |
method |
"S", "M" or "W", denotes score test, Mann-Whitney-Wilcoxon test and win odds test respectively. |
criterion |
1: minimizing the expected total sample size under the null hypothesis, 2: minimizing the expected total sample size under the alternative hypothesis, 3: minimizing the expected total sample size assuming that Pr(H0) = Pr(Ha), 4: balancing sample sizes of the two stages prioritizing EN0, 5: balancing sample sizes of the two stages prioritizing maximum sample size n2. |
lambda |
The ratio of sample sizes between the experimental and control groups, defined as sample size (experimental): sample size (control) = lambda:1. The default value is 1. |
method |
Statistical test chosen. |
criterion |
Criterion chosen. |
n1 |
The total sample size of the control and experimental groups required at the 1st analysis. |
t1l |
The lower threshold of the test statistic at the 1st analysis. |
t1u |
The upper threshold of the test statistic at the 1st analysis. |
n2 |
The cumulative total sample size of the control and experimental groups required at the 2nd analysis. |
t2 |
The threshold of the test statistic at the 2nd analysis. |
alpha = 0.05; beta = 0.2; p1 = c(0.2, 0.5, 0.2, 0.1) p2 = c(0.4, 0.3, 0.2, 0.1) ruleFS(alpha, beta, p1, p2, method="M", criterion="1", lambda = 1)alpha = 0.05; beta = 0.2; p1 = c(0.2, 0.5, 0.2, 0.1) p2 = c(0.4, 0.3, 0.2, 0.1) ruleFS(alpha, beta, p1, p2, method="M", criterion="1", lambda = 1)
This is the function to compute theta (i.e., the expectation of T), which is required for the Win Odds test.
theta(p1, p2)theta(p1, p2)
p1 |
A vector containing the probabilities of the outcome falling into each level of the control arm. |
p2 |
A vector containging the probabilities of the outcome falling into each level of the control arm. |
The value of theta
This is the function to compute the value of V over , which is requited for the score test, where denotes the total sample size at the kth analysis.
V_S.over.nk(p1, p2, lambda = 1)V_S.over.nk(p1, p2, lambda = 1)
p1 |
A vector containing the probabilities of the outcome falling into each level of the control arm. |
p2 |
A vector containging the probabilities of the outcome falling into each level of the control arm. |
lambda |
The ratio of sample sizes between the experimental and control groups, defined as sample size (experimental): sample size (control) = lambda:1. The default value is 1. |
The value of V over .
This is the function to compute W, which is required for the Win Odds test.
W_W(p1, p2, lambda = 1)W_W(p1, p2, lambda = 1)
p1 |
A vector containing the probabilities of the outcome falling into each level of the control arm. |
p2 |
A vector containging the probabilities of the outcome falling into each level of the control arm. |
lambda |
The ratio of sample sizes between the experimental and control groups, defined as sample size (experimental): sample size (control) = lambda:1. The default value is 1. |
The value of W.