Two Stage


Program Code

The program is written in R.


Sources

For background information see the book by Green, Benedetti and Crowley:


Error Thresholds

Stage 1 Error Threshold

Probability threshold for failing to reject the null at stage 1 when alternative is true; In other words, it is the probability threshold for erroneously accepting early futility defined as below:

P(X ≤ a1 | n1, pa)

Probability threshold for rejecting the null at stage 1 when the null is true; In other words, it is the probability threshold for erroneously rejecting futility at stage 1 and is defined as below:

P(X ≥ r1 | n1, p0)

Stage 2 Error Threshold

Probability threshold for rejecting the null at stage 2 when the null is true; In other words, it is the probability threshold for erroneously rejecting futility at stage 2 and is defined as below:

P(X ≥ r2 | n1 + n2, p0)


Definition of Variables

These are definitions of all variables referred to in the documentation:


Running the Program

The user is prompted for the type of calculation to be performed. There are 4 calculation steps. The first step determines the overall sample size for the design. The second step calculates the sample sizes for each stage. The third step determines SWOG critical values for the design (which can be modified by the user) and final step calculates design probabilities for the given study.

1) N (Sample Size Needed for a Two Stage Study)

The user is prompted for values to the following items.

2) SWOG Rule for Finding the a1's and r1's

In this option both p0 and pa are specified, along with the value px; al and rl are calculated differently from in the Fleming option. a1 is calculated to be the largest x such that the probability of getting a smaller value than x (given pa is true) is <= px.

The power is calculated for an array of pa values.