# Binary outcome sample size calculator

## Binary outcomes

Suppose you want to test whether more people respond to one drug versus another, or whether one advertising campaign is more effective than another. In either case, you have a binary outcome. Someone either responds to the drug or they don’t. They either buy the product or they don’t.

In either case you have a probability of something happening, *p*_{1} for one group and *p*_{2} for the other, and you would like to test whether the two probabilities are different enough to tell apart, i.e. that their difference is *statistically significant*. If you are designing an experiment, how many people should use in each group?

The answer depends on many factors. How different do you suspect the response rates are on the two different things you’re testing? The more similar the responses are, the larger sample it will take to tell them apart. How confident do you want to be in your conclusion? The more confident you want to be, the larger sample you will need. Do you want to assign more people to one treatment than the other? That’s OK, but it complicates things.

## Sample size calculator

The calculator below will estimate *n*, the number of subjects you need to assign to each group, based on your initial guesses at *p*_{1} and *p*_{2} and some common assumptions.

## Example

Suppose *p*_{1} = 0.1 and *p*_{2} = 0.3. Then the rule of thumb estimates that you need 64 subjects per group.

Note that *n* is the number in *each* group, so the total needed is 2*n*.

## Assumptions and details

The calculator above is based on the rule of thumb

where

The rule of thumb is based on the assumption of significance α = 0.05 and type II error β = 0.20, i.e. 80% power.

Note that this is only a rough estimate based on default assumptions. If you need to design an experiment, or sequence of experiments, we would be glad to help.

Brought to you by