Sample Size Calculation - Proportions
Requires a Wolfram Notebook System
Interact on desktop, mobile and cloud with the free Wolfram Player or other Wolfram Language products.
This Demonstration uses a normal approximation to the binomial distribution to estimate the minimum sample size, , for detecting a change in the proportion of a population with a particular characteristic (the proportion defective, for example). The sample size, , needed to detect a change of size in the proportion defective, at a confidence level of and with a power of depends on , , , and whether the test is one-sided or two-sided. To compare various sampling approaches, you can vary (the type I risk), (the type II risk), (the minimum size of change to be detected), as well as (the known, or estimated, proportion defective in the population). Note that . In many practical cases, the proportion defective is not known, but is estimated from prior sampling or experience.
Contributed by: Joe O'Hara (March 2011)
Open content licensed under CC BY-NC-SA
Although the exact sampling distribution for the proportion defective is a binomial distribution, in which is the probability of an individual item being defective, this Demonstration uses the normal approximation to the binomial distribution, which is valid for large . A rule of thumb is that should satisfy the test .
Suppose an experiment is to be conducted wherein a treatment of some sort is to be applied to a population. The investigator is interested in knowing the minimum sample size that should be randomly selected from the population to detect a change in the proportion having a certain characteristic as a result of the treatment. The statistical factors that influence the sample size are: - the value selected for , the type I risk (the risk of rejecting a true null hypothesis) - the value selected for , the type II risk (the risk of accepting the null hypothesis as true when, in reality, it is false) - the value of the population proportion defective, (this is often an estimate, based on judgement and experience) - the minimum size of the change to be detected by the sample,
The type I risk is that of getting a false positive from the sample. In other words, there is a probability that the sample will indicate that there is a difference of at least when, in fact, there is not.
The type II risk is that of getting a false negative from the sample. In other words, there is a probability that the sample will indicate there is not a difference of at least when, in fact, there is such a difference. The ability to detect a difference when there actually is one is called the power of the test and is equal to .
As mentioned, whether the test of the hypothesis is a one-sided or two-sided test has an effect on the sample size. A one-sided test would, for example, look either at whether the proportion defective is more than the hypothesized value OR at whether the proportion defective is less than the hypothesized value. A two-sided test would consider whether the proportion defective is significantly different from the hypothesized value, considering both tails of the distribution of the test.
The user of this Demonstration should mentally formulate a null hypothesis and an alternative hypothesis (either one- or two-sided). Then the appropriate control selections can be made and the resulting sample size can be examined. Typical values for and are 5% and 10%, respectively, resulting in a confidence of 95% and a test power of 90%. Note that making the detected difference, , small, drives a large sample size, as would be expected.