# Sample size calculator

Calculates the sample size for a survey (proportion) or calculates the sample size for a normal confidence interval.

Fill the proportion or the Standard deviation (σ).

.
To get the confidence interval of an estimate value ± MOE
leave empty for an infinite population. When the sample size is less then 5% of the entire population you can assume infinite population.
Shapiro Wilk test
Outliers count: ,based on the Tukey's fences method, k=1.5

Information

Calculates the sample size to achieve the required confidence interval.
Example
What sample size should you use for a survey in a city with a population of 120,000 people?
You want to have a confidence level of 95%.
The confidence interval should be ± 0.05 (± 5%).
Survey question: "what party will you vote?"

Solution
Confidence level = 0.95 .
If you don't know what proportions to expect you should assume the worth case meaning the largest standard deviation.
The largest standard deviation for a proportion is for Proportion = 0.5, which means that one party will gain 50% of the votes.
Population standard deviation (σ) - leave empty as it will be calculated from the proportion.
Margin of error (MOE) = 120,000 .
Population (N) = 120,000 .

## R Code

The following R code should produce the same results.