# Determining Sample Size

#### JohnM

##### TS Contributor
1. When you are asked to determine the minimum sample size required to estimate a population mean within a certain margin of error

n >= ((Za + Zb)^2) * (s/d)^2

where:
Za = z score corresponding to the desired level of confidence
Zb = z score corresponding to the desired level of statistical power**
s = estimated standard deviation
d = margin of error

** often this is not required, so the formula simplifies to:
n >= ((Za)^2) * (s/d)^2

Example

An electric company wants to estimate the average household electricity consumption per day, in kilowatt hours, during the month of August (high temperatures --> air conditioner usage).

They don't really have a good estimate of the variation, but they know that the minimum and maximum are around 20 kWhrs and 38 kWhrs, respectively.**

**a crude way to estimate the standard deviation in the absence of good data is to divide the range by 4, so here we will use (38-20)/4 = 18/4 = 4.5 as an estimate of s

They want to be within +/- 2 kWhrs, at a 95% confidence level, and at an 80% level of statistical power.

Therefore:

n >= ((Za + Zb)^2) * (s/d)^2

n >= ((1.96 + 1.282)^2) * (4.5/2)^2

n >= (10.511) * 5.06

n >= 54

2. When you are asked to determine the minimum sample size required to estimate a population proportion (percentage) within a certain margin of error

n >= ((p*q)/d^2) * Z^2

where:
p is the proportion you want to estimate, and the sample proportion is given in the problem
q = 1-p
d = margin of error, usually given as a "+/-" percentage points
Z = z score corresponding to the desired level of confidence

Example

Let's say you want to know the minimum sample size required to estimate the percentage of voters who will select a particular candidate in the upcoming election.

Assuming a close race, let's start with a worst case scenario - in the last election 51% voted for a particular candidate. You also want to be able to estimate the actual percentage to within +/- 3 percentage points, at a 95% confidence level. How many people do I need to poll?

n >= ((p*q)/d^2) * Z^2

n >= ((0.51 * 0.49)/(0.03^2)) * 1.96^2

n >= (.2499/.0009) * 3.8416

n >= 1067