The function `AnalyzeSetUp.Binomial`

must be run ahead of `Analyze.Binomial`

in order to set up the sequential analysis before the first group of data is analyzed. The function obtains the main parameter settings and performs basic calculations that are necessary for the subsequent sequential analysis.

1 2 3 | ```
AnalyzeSetUp.Binomial(name,N,alpha=0.05,zp="n",pp="n",M=1,
AlphaSpendType="Wald",rho="n", title="n",address="n")
``` |

`name` |
The name of the sequential analysis. Must be identical for all looks at the data, and the same as the name given in the subsequent calls to the |

`N` |
The maximum sample size, at which the sequential analysis stops without rejecting the null hypothesis. There is no default value. |

`alpha` |
The overall significance level. Must be in the range (0,0.5]. The default is "alpha=0.05". |

`zp` |
The prediction for z, the expected ratio between cases and controls under the null hypothesis that will be specified in the |

`pp` |
The prediction for p, the expected probability under the null hypothesis that will be specified in the |

`M` |
The minimum number of events required before the null hypothesis can be rejected. It must be a positive integer. The default value is "M=1". |

`AlphaSpendType` |
The type of alpha spending function to be used. The options are AlphaSpendType="Wald" and AlphaSpendType="power-type". With the 'Wald' option, the Wald type upper rejection boundary is used, which is flat with respect to the likelihood ratio. With the power-type option, the alpha spending uses a power function with parameter rho, with rho defined by the user. This alpha spending setting is automatically used when the |

`rho` |
The parameter rho is used to build the target alpha spending function according to a power-type function. See below for details. It is not used for other alpha spending options. The variable rho must be a positive number. The default value is "rho=1". |

`title` |
Title for the results shown in the output tables and the illustrative graphics. It can be any text string. The default is that there is no title. |

`address` |
The address of the directory where the settings information of this sequential analysis is saved. |

The function `AnalyzeSetUp.Binomial`

has to be executed once, but just once, to set up the general statistical characteristics of the intended
sequential analysis, which is performed using the companion `Analyze.Binomial`

function.

Sequential analysis methods are devoted to analyze data sets that accrue cumulatively over time, by conducting multiple statistical tests sequentially
as more data accrues. In such a setting, it is important to carefully plan the sequential analysis before the first data arrives. For example,
it is important to maintain certain analysis parameter values over time to avoid counting the same data twice, and to make sure that there
are no changes in the past data that has already been included in a prior test. To avoid these kinds of problems, the `AnalyzeSetUp.Binomial`

function is used to set the analysis parameters a priori and to create a place to save the data as it accumulates over time. At the time of each sequential test,
this information is then automatically imported by the `Analyze.Binomial`

function, to ensure the correct concatenation of old and new information.

At each test, the function `Analyze.Binomial`

makes this concatenation automatically, but it will only work if the function `AnalyzeSetUp.Binomial`

is executed before performing the very first test.

When running `AnalyzeSetUp.Binomial`

, the user has the opportunity to choose the directory where the file with the general setup information and
the historical data are to be saved. Alternatively, the user can click in the "Cancel" button, in which case this file will be saved in the temporary
directory. Important: The location of this parameter and data file is saved in the temporary directory, so that directory cannot be cleaned until
the sequential analysis has been completed. Each sequential analysis needs a different identifier, which is set using the "name" parameter. Once a name is chosen,
it has to be written exactly the same way when running the function `Analyze.Binomial`

.

`AnalyzeSetUp.Binomial`

and `Analyze.Binomial`

works for different types of alpha spending plans (*F(t)*). One option is to use the classical
Wald type upper rejection boundary, which is flat with respect to the likelihood function. This is the same boundary used by the `CV.Binomial`

and
`CV.G.Binomial`

functions. In order to use this boundary, one should pre-specify the binomial probability p under the null hypothesis, or,
equivalently, the ratio *z=1/p-1*, which is the number of controls matched to each case in a matched analysis. For example, if the probability of having
a case (instead of a control) is *p = 1=(1 + z) = 0.5*, then we have "z=1" (1:1 matching ratio), and, if p = 0.25, we have "z=3" (1:3 matching ratio).

In `AnalyzeSetUp.Binomial`

, the predicted z is specified (the input zp), but if it turns out that the actual z is different, that is okay,
since the actual z that is specified in `Analyze.Binomial`

does not have to be the same as the predicted zp that is specified
in `AnalyzeSetUp.Binomial`

. The latter is only used to set the alpha spending plan. The former, the actual z, is used to calculate the
likelihood function which in turn determines whether the null hypothesis should be rejected or not. If the actual z is variable, so that
it is different for different observations, we recommend setting the predicted z to be our best guess about the average of the actual zs.
Alternatively, instead of zp the user can specify pp, the best guess about the average of the actual ps.
Note that only one of these parameters has to be specified, but if both are entered the code will only work if zp and pp are such that pp=1/(1+zp).
Otherwise, an error message will appear to remind that such condition must be complied.

Another alpha spending option is the power-type alpha spending plan (Kim and DeMetz 1987, p150; Jennison and Turnbull 2000, p148), with parameter rho: *F(t)= alpha*t^{rho}*,
where *alpha* is the overall significance level and *t* is a fraction of N, the maximum length of sequential analysis.

In addition to selecting the alpha spending plan, it is necessary to specify the overall alpha, or maximum Type I error probability, for the sequential analysis as a whole. It is also necessary to specify the maximum length of the sequential analysis, N, so that the sequential analysis stops without rejecting the null hypothesis when N total observations have been obtained.

`inputSetUp` |
The |

Development of the AnalyzeSetUp.Binomial function was funded by:

- Food and Drug Administration, Center for Drug Evaluation and Research, through the Mini-Sentinel Project (base version, documentation);

- National Institute of General Medical Sciences, NIH, USA, through grant number R01GM108999 (user defined alpha spending functions, improved documentation);

We thank Claudia Coronel-Moreno for valuable editorial support.

`Analyze.Binomial`

: for running the sequential analysis that was set up using the `AnalyzeSetUp.Binomial`

function.

Ivair Ramos Silva, Martin Kulldorff.

Jennison C, Turnbull B. (2000), Group Sequential Methods with Applications to Clinical
Trials, *no. ISBN 0-8493-0316-8, London: Chapman and Hall/CRC*.

Kim K, DeMets DL. (1987), Design and Analysis of Group Sequential Tests Based on the Type I Error Spending Rate Function. Biometrika, **74**, n.1: 149–154.

Kulldorff M, Davis RL, Kolczak M, Lewis E, Lieu T, Platt R. (2011). A Maximized Sequential Probability Ratio Test for Drug and Safety Surveillance. *Sequential Analysis*, **30**: 58–78.

Kulldorff M, Silva IR. (2015). Continuous post-market sequential safety surveillance with minimum events to signal. arxiv:1503.01978 [stat.ap].

Silva IR, Kulldorff M. (2015). Continuous versus Group Sequential Analysis for Vaccine and Drug Safety Surveillance. Biometrics, in press.

1 | ```
# See example in the description of the Analyze.Binomial function.
``` |

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.