r_simon {VisualizeSimon2Stage} | R Documentation |
Random Generator based on Simon's Two-Stage Design
Description
Random generator based on Simon's two-stage design.
Usage
r_simon(R, n1, n, r1, prob)
Arguments
R |
positive integer scalar, number of trials |
n1 , n |
positive integer scalars, Stage-1 sample size |
r1 |
non-negative integer scalar, number of response
in Stage-1 |
prob |
double scalar, true response rate |
Details
Function r_simon generates copies of the number of responses
in the Simon's two-stage design.
The conclusion of the trials are,
indicates early termination
indicates failure to reject
indicates success to reject
Here is not needed to generate the random number of responses
.
Instead,
is needed to determine if the trial is a failure or a success.
Therefore,
is not a parameter in r_simon.
Value
Function r_simon returns an integer vector of length ,
which are the
copies of the number of responses in the Simon's two-stage design.
Examples
library(clinfun)
ph2simon(pu = .2, pa = .4, ep1 = .05, ep2 = .1) # using 'Optimal'
# set.seed if needed
(ys = r_simon(R = 10L, n1 = 19L, n = 54L, r1 = 4L, prob = .3))
table(cut.default(ys, breaks = c(0, 4L, 15L, 54L), right = TRUE,
labels = c('early-termination', 'fail', 'success')))