**Program Code**

The program is written in JavaScript.

**Source**

The program uses the approximate variance of the logarithm of the ratio of odds ratio.
Fleiss, J.L. *Statistical Rates and Proportions* (1981), page 165 provides the
variance estimate for an estimated odds ratio. The total sample size is calculated as
follows

*N = (q(1-**a**/2)+q(1-**b**)) ^{2} **

Where *f _{ij}* are the cell frequencies and

D*=log(o _{1}/o_{2})*

Where

*o _{j} = p_{1j}(1-p_{2j})/(p_{2j}(1-p_{1j}))
is the odds ratio for the treatment effect within stratum j*

**Input Items**

The user is prompted for values to the following items. For items that have initial default values set, the values are given in parentheses.

- a, the significance level (.05)

- One-sided or two-sided test

- f
_{11}, f_{12}, f_{21}, and f_{22}, the cell frequencies. By way of example, f_{11}is cell frequency in treatment group 1 and stratum 1. Note that*S*f_{ij}=1. (.25 for each cell)

- p
_{11}and p_{21}, the event probabilities for treatment 1 in stratum 1 and 2, respectively, which give the baseline probabilities of failure in each stratum.

- o
_{1}and o_{2}, the odds ratios between treatment 1 and treatment 2 within each of the strata.

- 1-b, the desired power for sample size estimation, or n, total sample size for power estimation