In statistics, including opinion polls and similar surveys, a margin of error is the radius of a confidence interval -- often a 90% confidence interval -- for a proportion of a population.

Example

For example, suppose the quantity of interest is the proportion of voters who will vote "yes" in a referendum. A random sample of the population of voters is taken, and it is found that 60% of voters in the sample will vote "yes". Then the estimated proportion of the whole population who will vote "yes" may be taken to be 60%. If a 3% margin of error is reported, that means a procedure was used that will be within 3% of the proportion to be estimated, 90% of the time. Consequently the interval from 57% to 63% is a 90% confidence interval for the proportion of voters in the whole population who will vote "yes". The radius of that interval is 3%; that is the margin of error.

How to compute a margin of error

Let n be the number of voters in the sample. Suppose them to have been drawn randomly and independently from the whole population of voters. This is perhaps optimistic, but if care is taken it can be at least approximated in reality. Let p be the proportion of voters in the whole population who will vote "yes". Then the number X of voters in the sample who will vote "yes" is a random variable with a binomial distribution with parameters n and p. If n is large enough, then X is approximately normally distributed with expected value np and variance np(1 - p). Therefore

is approximately normally distributed with expected value 0 and variance 1. Consulting tabulated percentage points of the normal distribution reveals that P(-1.645 < Z < 1.645) = 0.9, or, in other words, there is a 90% chance of this event. We have

This is equivalent to

Replacing p in the first and third members of this inequality by the estimated value X/n seldom results in large errors if n is big enough. This operation yields

The first and third members of this inequality depend on the observable X/n and not on the unobservable p, and are the endpoints of the confidence interval. In other words, the margin of error is