How to Compute a 95-Percent Confidence Interval
To compute a 95% confidence interval, you need three pieces of data: the mean (for continuous data) or proportion (for binary data); the standard deviation, which describes how dispersed the data is around the average; and the sample size.
Continuous data example
Imagine you asked 50 customers how satisfied they were with their recent experience with your product on an 7-point scale, with 1 = Not at all satisfied and 7 = Extremely satisfied. These are the steps you would follow to compute a confidence interval around your sample average:
Find the mean by adding up the scores for each of the 50 customers and divide by the total number of responses (which is 50).
If you have Microsoft Excel, you can use the function =AVERAGE() for this step. For the purpose of this example, you have an average response of 6.
Compute the standard deviation.
You can use the Excel formula =STDEV() for all 50 values. You have a sample standard deviation of 1.2.
Compute the standard error by dividing the standard deviation by the square root of the sample size.
Compute the margin of error by multiplying the standard error by 2.
.17 x 2 = .34
Compute the confidence interval by adding the margin of error to the mean from Step 1 and then subtracting the margin of error from the mean, like this:
6 + .34 = 6.34
6 – .34 = 5.66
You now know you have a 95% confidence interval of 5.66 to 6.34. The best estimate of what the entire customer population’s average satisfaction is ranges between 5.66 and 6.34.
If you have a smaller sample, you need to use a multiple greater than 2. You can find what multiple you need with an online calculator.
Discrete data example
Imagine you asked 50 customers if they are going to repurchase your service in the future. Using a dummy variable, you can code Yes = 1 and No = 0. If 40 out of 50 report their intent to repurchase, you can use what is called the Adjusted Wald technique to find your confidence interval:
Find the average by adding all the 1s and dividing by the number of responses.
40 / 50 =.8
Adjust the proportion to make it more accurate.
Add 2 to the numerator (the number of 1s).
40 + 2 = 42
Find the adjusted sample size by adding 4 to the denominator (total responses).
50 + 4 = 54
Divide the result to find the adjusted proportion.
42 / 54 = .78
Compute the standard error for proportion data.
Multiply the adjusted proportion by 1 minus the adjusted proportion.
.78 x (1 – .78)=.17
Divide the result (.17) by the adjusted sample size from Step 2.
.17 / 54 = .0031
Determine the square root of the value from the preceding step.
Compute the margin of error by multiplying the standard error (result from Step 3) by 2.
.057 x 2 = .11
Compute the confidence interval by adding the margin of error from the proportion from Step 1 and subtracting the margin of error from the proportion.
.78 + .11 = .89
.78 – .11 = .67
The 95% confidence interval is .67 to .89. The best estimate of the entire customer population’s intent to repurchase is between 67% and 89%.
Values are rounded in the preceding steps to keep them simple. If you want a more precise confidence interval, use the online calculator.