Type: Package
Title: Optimal Two-Stage Designs for Ordered Categorical Outcomes
Version: 1.0.2
Date: 2025-08-17
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.
License: GPL-3
Encoding: UTF-8
Depends: R (≥ 4.0)
Imports: stats
RoxygenNote: 7.3.2
NeedsCompilation: no
Packaged: 2025-09-01 09:24:41 UTC; ypark56
Author: Yeonhee Park [aut, cre], Yudi Wang [aut], Zhanpeng Xu [aut]
Maintainer: Yeonhee Park <yeonheepark@skku.edu>
Repository: CRAN
Date/Publication: 2025-09-05 20:40:02 UTC

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.

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.

Author(s)

Yeonhee Park [aut, cre], Yudi Wang [aut], Zhanpeng Xu [aut]

Maintainer: Yeonhee Park <yeonheepark@skku.edu>

References

Park, Y. (2025). Optimal two-stage group sequential designs based on Mann-Whitney-Wilcoxon test. PloS one, 20(2), e0318211.


Decision fule for the F design based on the Mann-Whitney-Wilcoxon test with specified values of alpha1 and beta1

Description

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.

Usage

Decision_rule_M.F(p1, p2, alpha1, beta1, alpha, beta, lambda = 1)

Arguments

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.

Value

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.

References

Park, Y. (2025). Optimal two-stage group sequential designs based on Mann-Whitney-Wilcoxon test. PloS one, 20(2), e0318211.

Examples

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)

Decision rule for the FS design based on the Mann-Whitney-Wilcoxon test with the specified values of alpha1, alpha2, and beta1

Description

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.

Usage

Decision_rule_M.FS(p1, p2, alpha1, alpha2, beta1, alpha, beta, lambda = 1)

Arguments

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.

Value

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.

References

Park, Y. (2025). Optimal two-stage group sequential designs based on Mann-Whitney-Wilcoxon test. PloS one, 20(2), e0318211.

Examples

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)

One-stage clinical trial design based on the Mann-Whitney-Wilcoxon test

Description

This is the function to determine the decision rule for a one-stage clinical trial designs based on the Mann-Whitney-Wilcoxon test.

Usage

Decision_rule_M_1stage(p1, p2, alpha, beta, lambda = 1)

Arguments

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.

Value

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.

References

Park, Y. (2025). Optimal two-stage group sequential designs based on Mann-Whitney-Wilcoxon test. PloS one, 20(2), e0318211.

Examples

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)

Decision rule for the F design based on the score test with the specified values of alpha1 and beta1

Description

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.

Usage

Decision_rule_S.F(p1, p2, alpha1, beta1, alpha, beta, lambda = 1)

Arguments

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.

Value

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.

Examples

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)

Decision rule of the FS design based on the score test with the specified values of alpha1, alpha2, and beta1

Description

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.

Usage

Decision_rule_S.FS(p1, p2, alpha1, alpha2, beta1, alpha, beta, lambda = 1)

Arguments

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.

Value

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.

Examples

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)

One-stage clinical trial design based on the score test

Description

This is the function to determine the decision rule for a one-stage clinical trial designs based on the score test.

Usage

Decision_rule_S_1stage(p1, p2, alpha, beta, lambda = 1)

Arguments

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.

Value

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.

References

Park, Y. (2025). Optimal two-stage group sequential designs based on Mann-Whitney-Wilcoxon test. PloS one, 20(2), e0318211.

Examples

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)

Decision rule of the F design based on the Win Odds test with the specified values of alpha1 and beta1

Description

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.

Usage

Decision_rule_W.F(p1, p2, alpha1, beta1, alpha, beta, lambda = 1)

Arguments

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.

Value

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.

Examples

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)

Decision rule of the FS design based on the Win Odds test with the specified values of alpha1, alpha2, and beta1

Description

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.

Usage

Decision_rule_W.FS(p1, p2, alpha1, alpha2, beta1, alpha, beta, lambda = 1)

Arguments

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.

Value

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.

Examples

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)

One-stage clinical trial design based on the Win Odds test

Description

This is the function to determine the decision rule for a one-stage clinical trial designs based on the Win Odds test.

Usage

Decision_rule_W_1stage(p1, p2, alpha, beta, lambda = 1)

Arguments

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.

Value

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.

Examples

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)

Checking proportional odds assumption

Description

This is the function to check the proportional odds assumption for the score test.

Usage

Proportional_odds_assumption(p1, p2)

Arguments

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.

Value

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.


Calculateion of Q or R

Description

This is the function to compute Q or R, which is required for the Mann-Whitney-Wilcoxon test.

Usage

QR_fun(p1, p2)

Arguments

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.

Value

The value of Q or R.


Calcualtion of V

Description

This is the function to compute the value of V over n_{..k}, which is requited for the score test, where n_{..k} denotes the total sample size at the kth analysis.

Usage

V_S.over.nk(p1, p2, lambda = 1)

Arguments

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.

Value

The value of V over n_{..k}.


Calculation of W

Description

This is the function to compute W, which is required for the Win Odds test.

Usage

W_W(p1, p2, lambda = 1)

Arguments

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.

Value

The value of W.


Performance evaluation of a one-stage design

Description

This is the function to calculate the operating characteristics for a one-stage design, including type I error, power, and expected sample size.

Usage

op.1stage(alpha, beta, p1, p2, method, n2, t2, nsim = 10000, lambda = 1)

Arguments

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.

Value

The probability of wrong decision and the expected total sample size under the true hypothesis.

Examples

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)

Performance evaluation of the F design

Description

This is the function to calculate the operating characteristics for the F design, including type I error, power, and expected sample size.

Usage

op.F(alpha, beta, p1, p2, method, n1, t1, n2, t2, nsim = 10000, lambda = 1)

Arguments

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.

Value

The probability of wrong decision and the expected total sample size under the true hypothesis.

Examples

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)
	

Performance evaluation of the FS design

Description

This is the function to calculate the operating characteristics for the FS design, including type I error, power, and expected sample size.

Usage

op.FS(alpha, beta, p1, p2, method, n1, t1l, t1u, n2, t2, nsim = 10000, lambda = 1)

Arguments

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.

Value

The probability of wrong decision and the expected total sample size under the true hypothesis.

Examples

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)
	

p2

Description

This is the function to calculate the probability p2 when p1 and odds ratio are given.

Usage

p2_fun(p1, theta)

Arguments

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.

Value

A numeric vector representing the expected probability distribution of outcomes across levels for the experimental group.


p_minus

Description

This is the function to comupute p-, which is required for the Mann-Whitney-Wilcoxon test.

Usage

p_minus(p1, p2)

Arguments

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.

Value

The value of p-.


p_plus

Description

This is the function to comupute p+, which is required for the Mann-Whitney-Wilcoxon test.

Usage

p_plus(p1, p2)

Arguments

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.

Value

The value of p+.


Calculation of pq

Description

This is the function to compute p_{jk} and q_{ik}, which are required for the Win Odds test.

Usage

pq_fun(p1, p2)

Arguments

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.

Value

The value of p_{jk} and q_{ik}.


Decision fule of the F design

Description

This is the function to determine the decision rule for the F design.

Usage

ruleF(alpha, beta, p1, p2, method, criterion, lambda = 1)

Arguments

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.

Value

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.

Examples

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)

Decision fule of the FS design

Description

This is the function to determine the decision rule for the FS design.

Usage

ruleFS(alpha, beta, p1, p2, method, criterion, lambda = 1)

Arguments

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.

Value

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.

Examples

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)

Calculation of theta

Description

This is the function to compute theta (i.e., the expectation of T), which is required for the Win Odds test.

Usage

theta(p1, p2)

Arguments

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.

Value

The value of theta