twostg_power: Power for two-stage designs

View source: R/desmon-extra.R

twostg_powerR Documentation

Power for two-stage designs

Description

Determines the operating characteristics of single-arm, two-stage designs.

Usage

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
)

Arguments

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 TRUE, the type-I and type-II errors are plotted for each combination of (valid) r1 and r2 values

Value

twostg_power returns vector with the following elements:

Pr.stop1.H0

probability of stopping after the first stage if p0 is true

Pr.stop1.H1

probability of stopping after the first stage if pa is true

type1

the overall type-I error

type2

the overall type-II error

E.tot.n.H0

expected total sample size if p0 is true

E.tot.n.H1

expected total sample size if pa is true

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

See Also

bin1samp_power; bin1samp_sim

Examples

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)


raredd/desmon2 documentation built on Feb. 9, 2023, 12:09 p.m.