Sample Size Calculation - Proportions

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.



  • [Snapshot]
  • [Snapshot]
  • [Snapshot]


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.


    • Share:

Embed Interactive Demonstration New!

Just copy and paste this snippet of JavaScript code into your website or blog to put the live Demonstration on your site. More details »

Files require Wolfram CDF Player or Mathematica.

Mathematica »
The #1 tool for creating Demonstrations
and anything technical.
Wolfram|Alpha »
Explore anything with the first
computational knowledge engine.
MathWorld »
The web's most extensive
mathematics resource.
Course Assistant Apps »
An app for every course—
right in the palm of your hand.
Wolfram Blog »
Read our views on math,
science, and technology.
Computable Document Format »
The format that makes Demonstrations
(and any information) easy to share and
interact with.
STEM Initiative »
Programs & resources for
educators, schools & students.
Computerbasedmath.org »
Join the initiative for modernizing
math education.
Step-by-Step Solutions »
Walk through homework problems one step at a time, with hints to help along the way.
Wolfram Problem Generator »
Unlimited random practice problems and answers with built-in step-by-step solutions. Practice online or make a printable study sheet.
Wolfram Language »
Knowledge-based programming for everyone.
Powered by Wolfram Mathematica © 2018 Wolfram Demonstrations Project & Contributors  |  Terms of Use  |  Privacy Policy  |  RSS Give us your feedback
Note: To run this Demonstration you need Mathematica 7+ or the free Mathematica Player 7EX
Download or upgrade to Mathematica Player 7EX
I already have Mathematica Player or Mathematica 7+