# Formula for confidence interval level doesn't give correct result

I am kind of new in calculation of confidence interval, so I hope it will not be a too basic question.

I have a normal distribution (with slightly longer left tail) as you can see in the picture. The sample size is 2286 and I am trying to calculate the level of 99% CI (confidence interval) with the formula below:

x_bar is the mean value of the sampled data which is around 7.57,

t_star is the confidence coefficient from the t-table which is 2.576 because of the size of the sample data,

s is estimated standard deviation which is around 1.71 (the standard deviation value is generated in SAS-program with std function),

and n is the sample size which is 2286 as mentioned above.

So the formula gives the upper limit as 7.66 with 99% confidence intervall. However, according to the histogram like below, I should get a value around 11.

What am I doing wrong?

The formula looks about right, so I say you have gotten the CI right as well.

I think the problem is that you may be mixing the concept of the confidence interval (which is associated with the mean and how accurately we can estimate it) with the empirical distribution percentiles.

The confidence interval says that with p% probability is the true but unknown distribution mean between these two boundaries (in your case 99%)

The 1% and 99% percentile give information on the boundaries of the entire distribution, saying that 98% of the distribution is located between the 1st and 99th percentile, given the assumed distribution mean and SD.

if ds is your data vector, the following function call will give you the distribution percentiles, which you will find in line with your histogram. I simulated some data below just for display

 ds<-rnorm(2286,7.57,1.71)
quantile(ds,c(.01,.99))
1%       99%
3.576438 11.527171


Trying either your formula, or using the t.test function in R will give you the confidence interval.

t.test(ds,conf.level=.99)

One Sample t-test

data:  ds
t = 211.21, df = 2285, p-value < 2.2e-16
alternative hypothesis: true mean is not equal to 0
99 percent confidence interval:
7.503461 7.688899
sample estimates:
mean of x
7.59618