Calculate the type I error or power of a multinomial (response and disease progression) single- or two-stage design under IUT:
*H_0: p_1 ≤ p_{01} \ OR \ p_2 ≥ p_{02} \ versus \ H_1: p_1 ≥ p_{11} > p_{01} \ AND \ p_2 ≤ p_{12} < p_{02}*

1 2 | ```
IUT.power(method, s1.rej, t1.rej, s1.acc, t1.acc, n1, s2.rej, t2.rej, n2, p.s, p.t,
output.all)
``` |

`method` |
design methods according to number of stage and stopping rule, "s1" represents single-stage design stopping for both efficacy and futility, "s2" represents two-stage design stopping for both efficacy and futility, "s2.f" represents two-stage design stopping for futility only. |

`s1.rej` |
first stage responses threshold to stop the trial for efficacy. Applied for "s1" or "s2". |

`t1.rej` |
first stage disease progressions threshold to stop the trial for efficacy. Applied for "s1" or "s2". |

`s1.acc` |
first stage responses threshold to stop the trial for futility. Applied for "s2" or "s2.f". |

`t1.acc` |
first stage disease progressions threshold to stop the trial for futility. Applied for "s2" or "s2.f". |

`n1` |
first stage sample size. Applied for "s1", "s2" or "s2.f". |

`s2.rej` |
second stage responses threshold to stop the trial for efficacy. Applied for "s2" or "s2.f". |

`t2.rej` |
second stage disease progressions threshold to stop the trial for efficacy. Applied for "s2" or "s2.f". |

`n2` |
second stage sample size. Applied for "s2" or "s2.f". |

`p.s` |
pre-specified response rate, |

`p.t` |
pre-specified disease progression rate, |

`output.all` |
logical, if FALSE (default), only output the value of power or type I error, otherwise, also output the probability of early termination (PET) and expected sample size (EN). Applied for "s2" or "s2.f". |

`prob` |
the power function |

Chang, M. N., Devidas, M., & Anderson, J. (2007).
*One- and two-stage designs for phase II window studies.*
*Statistics in medicine* **, 26(13)**, 2604-2614.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | ```
p01=0.1; p02=0.9
## Calculate type I error for single-stage design
max(IUT.power(method="s1", s1.rej=6, t1.rej=19, n1=25, p.s=p01, p.t=0),
IUT.power(method="s1", s1.rej=6, t1.rej=19, n1=25, p.s=1-p02, p.t=p02))
## Calculate power for single-stage design
IUT.power(method="s1", s1.rej=6, t1.rej=19, n1=25, p.s=p01+0.2, p.t=p02-0.2)
## Calculate type I error for two-stage design
max(IUT.power(method="s2", s1.rej=4, t1.rej=9, s1.acc=0, t1.acc=13, n1=13,
s2.rej=6, t2.rej=18, n2=11, p.s=p01, p.t=0),
IUT.power(method="s2", s1.rej=4, t1.rej=9, s1.acc=0, t1.acc=13, n1=13,
s2.rej=6, t2.rej=18, n2=11, p.s=1-p02, p.t=p02))
## Output PET and EN under null hypothesis
IUT.power(method="s2", s1.rej=4, t1.rej=9, s1.acc=0, t1.acc=13, n1=13,
s2.rej=6, t2.rej=18, n2=11, p.s=p01, p.t=p02, output.all=TRUE)[-1]
## Calculate power for two-stage design
IUT.power(method="s2", s1.rej=4, t1.rej=9, s1.acc=0, t1.acc=13, n1=13,
s2.rej=6, t2.rej=18, n2=11, p.s=p01+0.2, p.t=p02-0.2)
## Calculate type I error for two-stage design stopping for futility only,
## output PET and EN under null hypothesis
max(IUT.power(method="s2.f", s1.acc=0, t1.acc=13, n1=13,
s2.rej=6, t2.rej=18, n2=11, p.s=p01, p.t=0),
IUT.power(method="s2.f", s1.acc=0, t1.acc=13, n1=13,
s2.rej=6, t2.rej=18, n2=11, p.s=1-p02, p.t=p02))
## Output PET and EN under null hypothesis
IUT.power(method="s2.f", s1.acc=0, t1.acc=13, n1=13,
s2.rej=6, t2.rej=18, n2=11, p.s=p01, p.t=p02, output.all=TRUE)[-1]
## Calculate power for two-stage design
IUT.power(method="s2.f", s1.acc=0, t1.acc=13, n1=13,
s2.rej=6, t2.rej=18, n2=11, p.s=p01+0.2, p.t=p02-0.2)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.