# How to calculate the confidence interval from distributions overlap

1 view (last 30 days)
Yassine on 12 Mar 2021
Edited: Adam Danz on 13 Mar 2021
I am trying to compute the confidence interval between the distribution in blue (baseline) and the distribution in orange, which is updated with a moving window every time a new sample comes in. The confidence interval is how much area of the orange distribution lies below mu+3*sigma of the baseline (the vertical line).
Assuming that the 2 distributions have the same standard deviation, how to compute the area of the orange distribution to the left of the vertical line?
Adam Danz on 12 Mar 2021
> If the mean of the orange distribution is at the vertical line, I'm 50% confident [that the measurement is within normal].
Really? So if the mean of the orange data is centered on +3std of the blue mean, you're 50% certain that the two distributions are from the same population? That doesn't sound OK to me. +3 std is far from the mean and is often considered an outlier.

Adam Danz on 12 Mar 2021
It sounds like what you're looking for is to find the number of standard deviations between the mean of the orange distribution and the 3rd std of the blue distribution (the vertical line) which would be
nSTD = ((mean(blue)+3*std(blue)) - mean(orange)) / std(orange);
where negative values of nSTD means the mean of the orange distribution is to the right of the 3rd std of the blue distribution, 0 means the orange mean is on the blue 3rd std. If nSTD==3 that means the curves are on top of eachother.
Yassine on 13 Mar 2021
I fitted normal distributions and it worked with normcdf. Thanks!

Jeff Miller on 12 Mar 2021
I wouldn't call this a confidence interval either, but I think you can compute the shaded area probability like this:
% Values assumed or known them from elsewhere:
% I am guessing them from the figure--change them as appropriate:
blueCutoff = 0.0475;
sigma = 0.005;
orangeMean = 0.045;
% With those values, compute
zCutoff = (blueCutoff - orangeMean) / sigma;
p = normcdf(zCutoff); % this is the probability of the shaded area
Yassine on 13 Mar 2021
This works for me, thanks!