Know About Confidence Interval

Dhaval Raval
4 min readMay 29, 2023

--

Image source: — Google Image

A confidence interval is a range of values we are fairly sure our true value lies in.

A confidence interval is the mean of your estimate plus and minus the variation in that estimate. This is the range of values you expect your estimate to fall between if you redo your test, within a certain level of confidence.

‘Confidence’, in statistics, is another way to describe probability.

For example, if you construct a confidence interval with a 95% confidence level, you are confident that 95 out of 100 times the estimate will fall between the upper and lower values specified by the confidence interval.

Your desired confidence level is usually one minus the alpha(α) value you used in your statistical test:

Confidence level = 1 — α

So, if you are an alpha value of p < 0.05 for statistical significance, then your confidence level would be:

1 — 0.05 = 0.95 = 95%.

Photo by sydney Rae on Unsplash

Let’s take an example;

What is the probability of tomorrow’s temperature being 420 exactly?

Ans: Probability is ‘0’.

Because temperature is in continuous values. So we cannot predict tomorrow’s temperature as exactly 420.

You can say, it can be between 400 to 440.

· Sometimes samples don’t give quite the right result.

Point estimators(sample mean) are valuable, but they may give errors.

Because we are not dealing with the entire population, all we are doing is giving a best estimator.

If the sample we use is unbiased, then the estimate is likely to be close to the true value of the population.

· Specify a ‘range’ instead of single point of estimate.

Interval estimates of parameters: -

· Based on sample data(imaginary),

- The point estimate for mean balance = $1990

- Can we trust this estimate? -> No

· What do you think will happen if we took another random sample of 140 alumni? -> May Differ

· Because of this uncertainty, we prefer to provide the estimate of an interval (range) and associate a level of confidence with it.

Interval estimate = Point Estimate ± Margin of Error

Confidence Interval for population mean: -

· Start by choosing a confidence level (1 — α) % (e.g., 99%, 95%, 90%).

· Then, the population mean will be within X̄ ± Z * σ/√n.

· Margin of errors depends on the underlying uncertainty confidence level and sample size.

Let’s take an example,

X̄ = 1990, σ = 2500, n = 140, Z = 1.96

Solution: — σ1 = σ/√n = 2500 / √140 = 211.29

Therefore, 1990 ± 1.96 * 211.29

Therefore, Range lies between [1576, 2404]

Note: — In python, we write as;

From scipy import stats

stats.norm.ppf(.975) { .975 is just a random digit

Calculating a Confidence Interval: -

Photo by Scott Graham on Unsplash

If you want to calculate a confidence interval on your own, you need to know:

1. The point estimate you are constructing the confidence interval for

2. The critical values for the test statistic

3. The standard deviation of the sample

4. The sample sizes

Once you know each of these components, you can calculate the confidence interval for your estimate by plugging them into the confidence interval formula that corresponds to your data.

When to use Confidence Interval: -

Photo by Brett Jordan on Unsplash

You can calculate confidence intervals for many kinds of statistical estimates, including:

· Proportions

· Population means

· Differences between population means or proportions

· Estimates of variation among groups

These are all point estimates, and don’t give any information about the variation around the number. Confidence intervals are useful for communicating the variation around a point estimate.

Conclusion: -

In conclusion, a confidence interval is a statistical concept that provides a range of values within which a population parameter is likely to fall.

Understanding confidence intervals helps researchers and analysts communicate the precision and reliability of their estimates. It acknowledges the inherent uncertainty in statistical inference and provides a measure of the range within which the true population parameter is likely to fall.

--

--