Calculates the sample size for binomial tests (R.W. Payne & D.A. Murray).

### Options

`PRINT` = string token |
What to print (`replication` , `power` ); default `repl` , `powe` |
---|---|

`PRMETHOD` = string token |
Method to be used to calculate the probabilities for the binomial test (`angular` , `normalapproximation` , `exact` ); default `norm` |

`PROBABILITY` = scalar |
Significance level for the test; default 0.05 |

`POWER` = scalar |
The required power (i.e. probability of detection) of the test; default 0.9 |

`TMETHOD` = string token |
Type of test to be done (`onesided` , `twosided` ); default `ones` |

`NULL` = scalar |
Probability under the null hypothesis for the one-sample test; default 0.5 |

`RATIOREPLICATION` = scalar |
Ratio of replication sample2:sample1 (i.e. the size of sample 2 should be `RATIOREPLICATION` times the size of sample 1); default 1 |

`REPLICATION` = variate |
Replication values for which to calculate and print or save the power; default `*` takes 11 replication values centred around the required number of replicates |

### Parameters

`P1` = scalars |
Probability to detect in sample 1 |
---|---|

`P2` = scalars |
Probability to detect in sample 2 |

`NREPLICATES` = scalars |
Saves the required number of replicates |

`VREPLICATION` = variates |
Numbers of replicates for which powers have been calculated |

`VPOWER` = variates |
Power (i.e. probability of detection) for the various numbers of replicates |

### Description

`SBNTEST`

calculates the number of replicates (or sample size) required for a binomial test. A one-sample binomial test assesses the evidence that the probability of success within a sample differs from some specific value. The probability that needs to be detected is specified by the `P1`

parameter, and the value from which it needs to be distinguished (i.e. the value under the null hypothesis) is specified by the `NULL`

option. If `NULL`

is not set, the default is 0.5. Alternatively, a two-sample test assess the evidence that probabilities within two samples are different. The anticipated probability within the first sample is then specified by the `P1`

parameter, and the probability within the second sample (from which it must be distinguished) is specified by the `P2`

parameter.

The `PRMETHOD`

option defines the type of binomial test that is to be done. The `normalapproximation`

setting relates to a test based on the Normal approximation to the binomial distribution (see the `BNTEST`

procedure), while the `angular`

setting is for a test using an angular transformation of the probabilities. The final setting, `exact`

, is available only for the one-sample test and assumes an exact test using the binomial distribution.

The significance level for the test is specified by the `PROBABILITY`

option (default 0.05 i.e. 5%). The required probability for detection of the difference between the probabilities (that is, the *power* of the test) is specified by the `POWER`

option (default 0.9). It is generally assumed that the sizes of the samples in the two-sample test should be equal. However, you can set the `RATIOREPLICATION`

option to a scalar, `R`

say, to indicate that the size of the second sample should be `R`

times the size of the first sample. By default, `SBNTEST`

assumes a one-sided test is to be used, but you can set option `TMETHOD=twosided`

to take a two-sided test instead. The `NREPLICATES`

parameter allows you to save the required size of the first sample.

The `PRINT`

option controls printed output, with settings:

`replication` |
to print the required number of replicates in each sample (i.e. the size of each sample); |
---|---|

`power` |
to print a table giving the power (i.e. probability of detection) provided by a range of numbers of replicates. |

By default both are printed.

The replications and corresponding powers can also be saved, in variates, using the `VREPLICATION`

and `VPOWER`

parameters. The `REPLICATION`

option can specify the replication values for which to calculate and print or save the power; if this is not set, the default is to take 11 replication values centred around the required number of replicates.

Options: `PRINT`

, `PRMETHOD`

, `PROBABILITY`

, `POWER`

, `TMETHOD`

, `NULL`

, `RATIOREPLICATION`

, `REPLICATION`

.

Parameters: `P1`

, `P2`

, `NREPLICATES`

, `VREPLICATION`

, `VPOWER`

.

### Method

When `PRMETHOD=normalapproximation`

, the distribution of the probability in sample *i* is approximated by a Normal distribution with mean *p _{i}* and variance

*p*(1-

_{i}*p*)/

_{i}*n*, where

_{i}*p*is the binomial probability and

_{i}*n*is the sample size. With

_{i}`PRMETHOD=angular`

, the probability is transformed to radians by an angular distribution, and the variance is then √(0.25/*n*). For

_{i}`PRMETHOD=exact`

, the calculations are done using the `CUBINOMIAL`

and `EDBINOMIAL`

functions (one-sample test only).### See also

Procedure: `BNTEST`

.

Commands for: Design of experiments.

### Example

CAPTION 'SBNTEST example',\ '1) one-sample test, probability to detect 0.7.'; STYLE=meta,plain SBNTEST [PRINT=replication,power; TMETHOD=twosided] 0.7 CAPTION '2) two-sample test, probabilities 0.4 and 0.6.' SBNTEST [PRINT=replication,power; TMETHOD=twosided] 0.4; P2=0.6