Often in statistics we’re interested in estimating the value of some population parameter such as a population proportion or a population mean.

To estimate these values, we typically gather a simple random sample and calculate the sample proportion or the sample mean.

We then construct a confidence interval to capture our uncertainty around these estimates.

We use the following formula to calculate a confidence interval for a population proportion:

**Confidence Interval = p**** ± z*√p(1-p) / n**

where:

**p:**sample proportion**z:**the chosen z-value**n:**sample size

And we use the following formula to calculate a confidence interval for a population mean:

**Confidence Interval = x̄**** ± z*(s/√n)**

where:

**x̄:**sample mean**z:**the chosen z-value**s**: sample standard deviation**n:**sample size

**In both formulas, there is an inverse relationship between the sample size and the margin of error.**

The larger the sample size, the smaller the margin of error. Conversely, the smaller the sample size, the larger the margin of error.

Check out the following two examples to gain a better understanding of this.

**Example 1: Sample Size and Margin of Error for a Population Proportion**

We use the following formula to calculate a confidence interval for a population proportion:

**Confidence Interval = p**** ± z*√p(1-p) / n**

The portion in red is known as the **margin of error**:

**Confidence Interval = p**** ± z*√p(1-p) / n**

Notice that within the margin of error, we divide by n (the sample size).

Thus, when the sample size is large we divide by a large number, which makes the entire margin of error smaller. This leads to a narrower confidence interval.

For example, suppose we collect a simple random sample of data with the following information:

**p:**0.6**n:**25

Here’s how to calculate a 95% confidence interval for the population proportion:

- Confidence Interval = p ± z*√p(1-p) / n
- Confidence Interval = .6 ± 1.96*√.6(1-.6) / 25
- Confidence Interval = .6 ± 0.192
- Confidence Interval =
**[.408, .792]**

Now consider if we instead used a sample size of 200. Here’s how we would calculate the 95% confidence interval for the population proportion:

- Confidence Interval = p ± z*√p(1-p) / n
- Confidence Interval = .6 ± 1.96*√.6(1-.6) / 200
- Confidence Interval = .6 ± 0.068
- Confidence Interval =
**[.532, .668]**

Notice that just by increasing the sample size we were able to reduce the margin of error and produce a much more narrow confidence interval.

**Example 2: Sample Size and Margin of Error for a Population Mean**

We use the following formula to calculate a confidence interval for a population mean:

**Confidence Interval = x̄ ± z*(s/√n)**

The portion in red is known as the **margin of error**:

**Confidence Interval = x̄ ± z*(s/√n)**

Notice that within the margin of error, we divide by n (the sample size).

Thus, when the sample size is large we divide by a large number, which makes the entire margin of error smaller. This leads to a narrower confidence interval.

For example, suppose we collect a simple random sample of data with the following information:

**x̄:**15**s**: 4**n:**25

Here’s how to calculate a 95% confidence interval for the population mean:

- Confidence Interval = x̄ ± z*(s/√n)
- Confidence Interval = 15 ± 1.96*(4/√25)
- Confidence Interval = 15 ± 1.568
- Confidence Interval =
**[13.432, 16.568]**

Now consider if we instead used a sample size of 200. Here’s how we would calculate the 95% confidence interval for the population mean:

- Confidence Interval = x̄ ± z*(s/√n)
- Confidence Interval = 15 ± 1.96*(4/√200)
- Confidence Interval = 15 ± 0.554
- Confidence Interval =
**[14.446, 15.554]**

Notice that just by increasing the sample size we were able to reduce the margin of error and produce a more narrow confidence interval.

**Additional Resources**

The following tutorials provide additional information about confidence intervals for a proportion:

- An Introduction to Confidence Intervals for a Proportion
- Confidence Interval for Proportion Calculator

The following tutorials provide additional information about confidence intervals for a mean: