The formula for a confidence interval for a mean is
![]()
where Z = Z
a/2. For example, the value of Z
in a 95% confidence interval is 1.96 because
If the distribution is Normal, but the sample size is small, you replace Z with t with (n-1) degrees of freedom. In the formula, s can be replaced by s if the population standard deviation is known (which doesn't happen too often).
The formula for a confidence interval for a proportion is
![]()
where the same rules stated above apply.
By the way, the second term in both formulas is known officially as the bound on the error. Usually, especially with proportions, it is called the margin of error.