# How to calculate / correct Standard Error or Confidence Intervals for bounded scales?

When conducting an experiment, often the data collected is interval or ratio, and as such unbounded. However, when attempting to make inferences about the population, reality often provides us with some constraints (e.g., 0 age, or 100%).

But, when you compute standard erros and/or confidence intervals, I often see plots (even in published articles) where the error bars take on impossible or nonsense values (e.g., 110%, -2 kids).

How do I calculate SE or confidence intervals when my scale has limits (is bounded)?

To be specific, I conducted a lie detection study, people rated 20 videos as lie-truth, so range 0-20, but I want to plot the data as %, however, my CIs make no sense (some below 0%, some over 100%).

What should I do?

(P.S. some recommend percentile bootstrapped CIs, yet others say never use these)

• Without knowing the specific instances involved, it seems difficult to diagnose what went wrong with the confidence intervals and error bars (often having little to do with confidence intervals) you may have seen. But you should get useful results for your experiment by using the method in my answer. – BruceET Oct 19 at 18:34

In your study of subjects deciding whether or not to believe 20 videos are factual, it seems easy to get a reasonable confidence interval. Roughly speaking, suppose you have $$100$$ subjects who viewed the $$20$$ videos, and that on average 25% of the videos are believable.

Then you may have data similar to the 100 in the list x below (simulated using R). These are numbers of videos each of the subjects found believable. Notice that this sample has mean $$\bar X = 5.07$$ and standard deviation $$S_x = 2.07.$$

set.seed(1019)
x = rbinom(100, 20, .25)
summary(x); sd(x)
Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
1.00    3.00    5.00    5.07    6.00   10.00
[1] 2.070744


If you want the percentages of 20 videos each subject found believable, then you have 100 percentages $$p$$ with mean $$\bar p = 0.2535$$ and standard deviation $$S_p = 0.1035,$$

p = x/20
summary(p); sd(p)
Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
0.0500  0.1500  0.2500  0.2535  0.3000  0.5000
[1] 0.1035372


Then a standard 95% confidence interval for the percentage believable is of the form $$\bar p \pm 1.96S_p/\sqrt{100},$$ which computes to $$(0.233, 0.274).$$ The boundaries of this CI are safely within the interval $$[0,1].$$

mean(p) + c(-1,1)*1.96*sd(p)/10
[1] 0.2332067 0.2737933


If only 1 in 20 of the videos is believable then you might get a CI such as the one below, still with suitable endpoints.

 x = rbinom(100, 20, .05); p = x/20
mean(p) + c(-1,1)*1.96*sd(p)/10
[1] 0.03767976 0.05432024


If you want to share a specific computation along these lines that gives a result you find unsatisfactory, please edit it into your question and leave a comment.

Note: If you had only 10 especially gullible or skeptical subjects, proportions may be very near 0 or 1, and the normal approximation involved in making the CIs above may be problematic. With such extreme results from only 10 subjects your results may not be reliable, but the method shown above still gives confidence limits between 0 and 1 in the two examples below.

x = rbinom(10, 20, .01); p = x/20
mean(p) + c(-1,1)*1.96*sd(p)/10
[1] 0.001900968 0.008099032

x = rbinom(10, 20, .99); p = x/20
mean(p) + c(-1,1)*1.96*sd(p)/10
[1] 0.985868 0.994132