We can define confidence interval as a measure of the degree of uncertainty or certainty in a sampling method.
To calculate confidence interval, we use sample data that is, the sample mean and the sample size.
We get the values of z for the given confidence levels from statistical tables.
In this case we are specifically looking at 95 % level of confidence.
Formula to calculate 95 confidence interval.
Confidence interval is sample mean, plus or minus the margin of error ( z* value multiplied by standard deviation divide by the square root of the sample size.)
![Calculate 95 Confidence Interval.](https://www.learntocalculate.com/wp-content/uploads/2020/05/confidencce-interval-4.png)
Example:
We know our confidence level is 95% and the corresponding z value is 1.96.
Suppose we take a random sample size of 50 dogs, we are asked to determine that the mean age is 7 years, with a 95% confidence level and a standard deviation of 4.
![Calculate 95 Confidence Interval.](https://www.learntocalculate.com/wp-content/uploads/2020/05/confidencce-interval-3-1.png)
Therefore, with 95 % confidence interval, the average age of the dogs is between 7.5657 years and 6.4343 years.