SAMPLE SIZE AND MARGIN OF ERROR

The Relationship Between Sample Size and Margin of Error
by Zach BobbittPosted on
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:
Posted in Programming

Hey there. My name is Zach Bobbitt. I have a Masters of Science degree in Applied Statistics and I’ve worked on machine learning algorithms for professional businesses in both healthcare and retail. I’m passionate about statistics, machine learning, and data visualization and I created Statology to be a resource for both students and teachers alike. My goal with this site is to help you learn statistics through using simple terms, plenty of real-world examples, and helpful illustrations.
Post navigation
PrevHow to Rename Files in R (With Examples)
NextHow to Sum Specific Columns in Pandas (With Examples)
Leave a Reply
Your email address will not be published. Required fields are marked *
Comment *
Name *
Email *
Search
Search for:Search
ABOUT STATOLOGY
Statology makes learning statistics easy by explaining topics in simple and straightforward ways. Our team of writers have over 40 years of experience in the fields of Machine Learning, AI and Statistics. Learn more about our team here.
Featured Posts
- The Concise Guide to Exponential DistributionApril 3, 2025
- How to Connect to a SQL Database with PythonApril 3, 2025
- How to Vectorize in Python (With Example)April 2, 2025
- Understanding Violin Plots vs. Box PlotsApril 2, 2025
- The Concise Guide to Poisson DistributionApril 1, 2025
- How to Handle Large Data Files Efficiently in RApril 1, 2025
Statology Study
Statology Study is the ultimate online statistics study guide that helps you study and practice all of the core concepts taught in any elementary statistics course and makes your life so much easier as a student.

Introduction to Statistics Course
Introduction to Statistics is our premier online video course that teaches you all of the topics covered in introductory statistics. Get started with our course today.

You Might Also Like
- Confidence Interval for a Proportion
- What is a Population Proportion?
- Standard Error of the Proportion: Formula & Example
- How to Interpret Margin of Error (With Examples)
- Margin of Error vs. Confidence Interval: What’s the…
- What are Confidence Intervals?
© 2023 Statology | Privacy Policy
Wisteria Theme by WPFriendship ⋅ Powered by WordPressDO NOT SELL OR SHARE MY INFORMATION