Is it possible to get the Confidence Interval of a couple of numbers (or more) without knowing the distribution or anything like that ?


  • 2
    $\begingroup$ What kind of confidence interval do you seek for two numbers, say $x_1 = 3.8$ and $x_2 = 4.8$? Both lie in the interval $[3.8, 4.8]$ with $100\%$ confidence (or if you like in the interval $[\bar{x}-\sigma,\bar{x}+\sigma]$ where $$\bar{x} = \frac{x_1+x_2}{2} = 4.3$$ is the sample mean and $$\sigma=\sqrt{\left.\left.\frac{1}{2-1}\right[(x_1-\bar{x})^2+(x_2-\bar{x})^2\right]} =\frac{1}{\sqrt{2}}$$ is the sample standard deviation. What are you really trying to estimate? $\endgroup$ – Dilip Sarwate Dec 28 '11 at 2:26
  • $\begingroup$ @DilipSarwate : thanks. I am looking for something like xbar +- sigma , with 95% CI. Just to be sure, I dont need to know the distribution, right ? Also, how do I do the confidence percentile ? $\endgroup$ – Ahsan Dec 28 '11 at 2:37
  • $\begingroup$ @DilipSarwate : I have a few packet loss percentage. I want to get the 95% CI for those... (i dont have too many..since these are real life data and not simulation data) $\endgroup$ – Ahsan Dec 28 '11 at 2:55
  • 1
    $\begingroup$ Yes, Ahsan, you need to make some hypothesis on the distribution. You’re telling us that your data is a packet loss percentage, can we know a little more ? If you observe N packets, n of which are lost (N big and n small), you don’t have only one observation, but N. Tell us more, we can direct you on confidence interval procedures for percentages. $\endgroup$ – Elvis Dec 28 '11 at 8:08
  • $\begingroup$ @ElvisJaggerAbdul-Jabbar : well, i have some code and using that in real life, i calculate some packet loss. now multiplying packet loss by 100 and dividing by total packets sent, i get the % packet lost. I redo the experiment 10-15 times. So, I have 10-15 %packet loss values. I want to get the CI so that I know where the future packet loss values might be in. I understand that 10-15 times is very little, but its not possible to do it more than that since its real life experiment and not simulation. thanks. $\endgroup$ – Ahsan Dec 28 '11 at 13:52

I assume that you observed a (big enough) number $n$ of packets, amoung which $x$ packets were lost. You have an estimation of the proportion $p$ of packet loss, $\hat p = {x\over n}$.

The usual Confidence Interval procedure gives a 95% CI $$ \left[ \hat p - 1.96 \sqrt{\hat p (1 -\hat p) \over n} ; \hat p + 1.96 \sqrt{\hat p (1 -\hat p) \over n}\right],$$ which is usually considered as valid if $n p > 5$ and $n(1-p)>5$ on the whole interval.

As I assume that the proportion $p$ you estimate is small, I give you this Confidence Interval procedure which is robust for small values of $p$.

Let $\Phi(p) = \arcsin(\sqrt p)$ for $p\in [0,1]$.

A 95% CI on $\Phi(p)$ is given by

$$\left[ \Phi\left({ x - 0,5 \over n}\right) - 1,96 { 1 \over 2 \sqrt n} ; \Phi\left({x + 0,5 \over n}\right) + 1,96 {1 \over 2 \sqrt n} \right]$$

To get a CI on $p$, use the inverse transformation $\Phi^{-1}(y)=\sin(y)^2$ on the bounds of this interval.

  • $\begingroup$ well, my packet loss percentage range from very little (0.0% to as high as 21%). ..can I still use this formula ? (I am a lil confused..can you have a look at my comments in response to yours in the question section ? thanks) $\endgroup$ – Ahsan Dec 28 '11 at 13:56
  • $\begingroup$ You should pool all your data together: if you sent a total of 10000 packets and the total number of losses is 45, take x = 45 and n = 10000. The fact that in fact you made 10 experiments sending each time 1000 packets doesn’t matter as long as you consider that the probability of packet loss is constant (and you need this assumption if you want to estimate this probability). I think that for your application you need to do that... $\endgroup$ – Elvis Dec 28 '11 at 14:28
  • $\begingroup$ However if it seems that this probability varies from an experiment to an other, the problem is more difficult; but if you know how to handle such a situation and want to do it, this could be done, for example modeling the probability $p$ of packet loss as a random variable taken in a beta distribution. You would then infer the parameters of the beta distribution... $\endgroup$ – Elvis Dec 28 '11 at 14:29
  • $\begingroup$ since its packet loss (and wireless network is so unreliable), the probability is not fixed !!! ....however, with 10-15 data points its a little difficult to pinpoint the distribution. for a particular model, my mean is around 20 and SD is around 5.5. I have, for the time being, used STATA to compute CI (assuming normal distribution). I am thinking that it might be alright given that its considerably higher than the other model output (mean 4, CI 2 & 6) -there should be difference since one model is better than the other! $\endgroup$ – Ahsan Dec 28 '11 at 14:46
  • $\begingroup$ currently, computing the CIs assuming normal distribution. $\endgroup$ – Ahsan Dec 28 '11 at 14:48

Generally a confidence interval is about a parameter of a population/distribution, not the observed values. As such there needs to be some assumptions (even saying that your are confident that the mean lies between minus infinity and infinity assumes that it is a real number).

Here is an article that derived a formula for a confidence interval for the mean with a sample of size 1 (they do make some assumptions):

An Effective Confidence Interval for the Mean With Samples of Size One and Two Melanie M Wall, James Boen, Richard Tweedie. The American Statistician. May 1, 2001, 55(2): 102-105. doi:10.1198/000313001750358400.

If you are looking at proportions or counts then you can use binomial or poisson distributions that can be estimated using 1 or 2 data points. If you are not happy with those assumptions then you will need to make some others.


Converting my comment into an answer in view of the OP's response, given any two numbers $x_1$ and $x_2$, their average value (or sample mean) is $$\bar{x} = \frac{x_1+x_2}{2}.$$ The sample standard deviation is $$ \sigma = \sqrt{\left.\left.\frac{1}{2-1}\right[(x_1-\bar{x})^2+(x_1-\bar{x})^2\right]} = \frac{|x_2-x_1|}{\sqrt{2}} \approx 0.707|x_2-x_1| $$ Assume without loss of generality that $x_1 \leq x_2$. Obviously, $[x_1, x_2]$ is a $100\%$ confidence interval for the observations which does not even require any calculations of $\bar{x}$ or $\sigma$, but even greater confidence can be generated among the non-cognoscenti by saying that $\left[\bar{x}-\sigma/\sqrt{2},\bar{x}+\sigma/\sqrt{2}\right]$ is a $100\%$ confidence interval for the observations.

  • $\begingroup$ thanks. 1. what will the multiplier be in case of 95% CI ? and 2. this process of finding the CI doesnt depend on the distribution (normal, inv. gaussian, exp etc), right ? thanks. $\endgroup$ – Ahsan Dec 28 '11 at 4:13
  • 1
    $\begingroup$ Usually, confidence interval are constructed for unobserved values... I don’t even think Ahsan got your point, cf his additional question. $\endgroup$ – Elvis Dec 28 '11 at 7:54
  • $\begingroup$ @ElvisJaggerAbdul-Jabbar : well, i have some values (packet loss percentage)...i want to get the CI so that I know in what range will the future packet loss most likely be in..... $\endgroup$ – Ahsan Dec 28 '11 at 13:45

Assuming that you have enough observations, you can then use the central limit theorem. This will mean that you have a standard normal distribution to work with.

From then on, it depends on what percentage your significant level needs to be to compute the confidence interval. Calculate the sample variance (s^2) and your confidence interval will be:

Xbar ± s/sqrt(N) where N is the number of observations.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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