# \donttest{
## A fixed sample (single stage) design specified on the p scale
mams(K=4, J=1, alpha=0.05, power=0.9, r=1, r0=1, p=0.65, p0=0.55)
## The same design specified on the delta scale
mams(K=4, J=1, alpha=0.05, power=0.9, r=1, r0=1, p=NULL, p0=NULL,
delta=0.545, delta0=0.178, sd=1)
## An example in Table 1 of Magirr et al (2012)
# 2-stage design with O'Brien & Fleming efficacy and zero futility boundary
mams(K=4, J=2, alpha=0.05, power=0.9, r=1:2, r0=1:2, p=0.65, p0=0.55,
ushape="obf", lshape="fixed", lfix=0, nstart=40)
## An example of separate stopping rules
# 2-stage design with O'Brien & Fleming efficacy and zero futility boundary
mams(method = "sep",K=4, J=2, alpha=0.05, power=0.9, r=1:2, r0=1:2,
p=0.65, p0=0.55, ushape="obf", lshape="fixed", lfix=0, nstart=40)
# An example of running drop-the-losers design
# `K` should be defined as vector length of J defining allocation arms per
# stages with final element equal to 1.
mams(method = "dtl", K=c(4,1), J=2, alpha=0.05,
power=0.9, r=1:2, r0=1:2, p=0.65, p0=0.55, ushape="obf",
lshape="fixed", lfix=0, nstart=40)
# Note that these examples may take a few minutes to run
## 3-stage design with Triangular efficacy and futility boundary
mams(K=4, J=3, alpha=0.05, power=0.9, r=1:3, r0=1:3, p=0.65, p0=0.55,
ushape="triangular", lshape="triangular", nstart=30)
## Different allocation ratios between control and experimental treatments.
## Twice as many patients are randomized to control at each stage.
mams(K=4, J=2, alpha=0.05, power=0.9, r=1:2, r0=c(2, 4), p=0.65,
p0=0.55, ushape="obf", lshape="fixed", lfix=0, nstart=30)
##
## example considering different parallelization strategies
##
# parallel = FALSE (future framework not used)
set.seed(1)
system.time(
print(mams(K=4, J=3, alpha=0.05, power=0.9, r=1:3, r0=1:3,
p=0.65, p0=0.55, ushape="triangular", lshape="triangular",
nstart=30, parallel = FALSE))
)
# parallel = TRUE (default) with default strategy (sequential computation)
plan(sequential)
set.seed(1)
system.time(
print(mams(K=4, J=3, alpha=0.05, power=0.9, r=1:3, r0=1:3,
p=0.65, p0=0.55, ushape="triangular", lshape="triangular",
nstart=30))
)
# parallel = TRUE(default) with multisession strategy (parallel computation)
plan(multisession)
set.seed(1)
system.time(
print(mams(K=4, J=3, alpha=0.05, power=0.9, r=1:3, r0=1:3,
p=0.65, p0=0.55, ushape="triangular", lshape="triangular",
nstart=30))
)
plan("default")
# }
Run the code above in your browser using DataLab