MATLAB Answers

How to calculate the confidence interval from distributions overlap

조회 수: 56(최근 30일)
Yassine 12 Mar 2021
편집: Adam Danz 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?
  댓글 수: 3
Adam Danz
Adam Danz 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
Adam Danz 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.
  댓글 수: 3
Yassine 13 Mar 2021
I fitted normal distributions and it worked with normcdf. Thanks!

댓글을 달려면 로그인하십시오.

추가 답변(1개)

Jeff Miller
Jeff Miller 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

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by