1
$\begingroup$

I have a normally distributed dataset and an associated systematic error. I want to know the probability a measured value falls within this error range. So I think the I want to find the confidence level given a confidence interval on a normally distributed curve. I understand you would normally find a confidence interval given a confidence level but I cannot seem to find any pieces of code which work in the opposite direction.

Any advice is appreciated!

$\endgroup$
3
  • $\begingroup$ Something like $P(a<X<b)$, where $X$ is your distribution? $\endgroup$
    – Dave
    Commented Mar 20, 2020 at 17:42
  • $\begingroup$ Yes, I believe so. The probability that X falls within the error. $\endgroup$
    – agrot
    Commented Mar 20, 2020 at 17:53
  • $\begingroup$ Do you see why that’s not a confidence interval? How would you evaluate $P(a<X<b)$? $\endgroup$
    – Dave
    Commented Mar 20, 2020 at 18:05

2 Answers 2

2
$\begingroup$

If my comment is correct, then you don’t want to find the confidence interval. However, I think it would be valuable to find the confidence level, given the confidence interval.

Here is the formula for a usual confidence interval of the mean when the variance is unknown.

$$\bar{x}\pm t_{df, 1-\alpha/2} \dfrac{s}{\sqrt{n}}$$

Let’s call the confidence interval $(a, b)$.

First, notice that there is symmetry about $\bar{x}$. This means that we can focus on one side.

We know that half of the width of the confidence interval is $b-\bar{x}$, so:

$$b-\bar{x} = t_{df, 1-\alpha/2} \dfrac{s}{\sqrt{n}}$$

We now do the algebra to solve for $t$.

We know that $df=n-1$, so we look up $\sqrt{n}(b-\bar{x})/s=t$ in a reference table. Software will do that for us. Here is R code:

pt(t, df)

We now have $1-\alpha/2$. Now solve for $\alpha$.

$1-\alpha$ is the confidence level.

$\endgroup$
2
  • $\begingroup$ Thanks you very much this makes sense now! $\endgroup$
    – agrot
    Commented Mar 20, 2020 at 20:13
  • $\begingroup$ @argot Do you see why this is not what you want to do, though? (Perhaps this would be what you want to do, but the way you’ve phrased your question right now still makes me think you want $P(a<X<b)$, which is not a confidence interval.) $\endgroup$
    – Dave
    Commented Mar 20, 2020 at 20:40
0
$\begingroup$

I don’t believe the Confidence Interval is giving you what you think. It doesn’t say that there is an XX % probability that any particular measurement is within the CI. It says that, if you repeated the entire process of forming the CI a large number of times, the correct true mean is within XX % of the intervals formed.

To be able to say a single (future) measurement is within a particular range, you want to form a Prediction Interval. Or, if you want to to say a certain proportion of all future measurements are within a certain range, then you want a Tolerance Interval.

Or, if you want to become a Bayesian, you can form a Posterior Predictive Interval.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.