twostg_power | R Documentation |
Determines the operating characteristics of single-arm, two-stage designs.
twostg_power(p0, pa, n1, n2, r1, r2)
twostg_sim(
p0,
pa,
n1,
n2,
r1 = seq.int(n1),
r2 = seq.int(n1 + n2),
plot = TRUE
)
p0 , pa |
probability of success under the null and alternative hypotheses, respectively |
n1 , n2 |
sample size of first and second stage |
r1 , r2 |
maximum number of responses in first stage and overall where treatment is declared ineffective |
plot |
logical; if |
twostg_power
returns vector with the following elements:
Pr.stop1.H0 |
probability of stopping after the first stage
if |
Pr.stop1.H1 |
probability of stopping after the first stage
if |
type1 |
the overall type-I error |
type2 |
the overall type-II error |
E.tot.n.H0 |
expected total sample size if |
E.tot.n.H1 |
expected total sample size if |
twostg_sim
returns a data frame with columns for each of the above
plus the following:
r1 |
critical values for the first stage |
r2 |
critical values for the second stage |
bin1samp_power
; bin1samp_sim
p0 <- 0.1
pa <- 0.3
des <- desmon2:::simon(p0, pa)$designs[1L, ]
twostg_power(p0, pa, des[['n1']], des[['n2']], des[['r1']], des[['r2']])
## compare
des
## simulate over critical values
twostg_sim(p0, pa, des[['n1']], des[['n2']])
## Not run:
res <- twostg_sim(p0, pa, des[['n1']], des[['n2']])
with(res, {
iplotr::iscatter(
type1, type2, group = type1 < 0.1 & type2 < 0.2,
labels = list(
r1 = r1, r2 = r2,
alpha = round(type1, 3), power = round(1 - type2, 3)
)
)
})
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.