# Statistical independence of variables with confidence intervals

To test two probabilities for independence one way is to check whether $P(A, B) = P(A) \cdot P(B)$.

However, in a practical setup, the probabilities may have some confidence intervals. So, $P(A)$ is actually $P(A) \pm c_A$, $P(B)$ is actually $P(B) \pm c_B$ and $P(A,B)$ is actually $P(A,B) \pm c_{AB}$ (95% confidence for all variables).

Is there a standard way to assess for independence by taking into account the confidence intervals?

Also, does it make sense to "quantify" the independence by using some metric, for example the overlap between confidence intervals. In my application I measure the two variables day by day, and what I observe is that they start by being strongly dependent, but they become independent as time goes by.

• To check whether two random variables $X$ and $Y$ are independent one has to check that $P(X\in A, Y\in B)=P(X\in A)P(Y \in B)$ for all $A$ and $B$. Oct 7, 2014 at 7:12
• @StéphaneLaurent you are relating to independence between variables $X$ and $Y$ with multiple outcomes, but the question is about the independence between events $A$ and $B$. Or, at best it relates to multilevel variables $X,Y$ but still the specific dichotomous events $X=X_A$ and $Y=Y_B$. You are adding the concept of variables $X$ and $Y$ but this is not suggested by the question. Apr 11, 2022 at 13:19
• The final paragraph suggests that "variables" are not the correct description here: they appear to be stochastic processes. It would be nice to have some information -- any information -- about what these processes are, what these probabilities and events refer to, and how the probabilities and their CIs were estimated.
– whuber
Sep 19, 2023 at 19:37

To test two probabilities for independence one way is to check whether $$P(A, B) = P(A) \cdot P(B)$$.

...

Is there a standard way to assess for independence by taking into account the confidence intervals?

Using confidence intervals is not a standard way to test for independence. For instance, a contingency table with a Pearson's chi-squared test is more typical.

But if you would have just estimates of $$P(A)$$, $$P(B)$$ and $$P(A,B)$$ with confidence intervals then you might reverse engineer the original data and compute the independence according to the standard way. How to do this exactly will depend on the way that the confidence intervals had been computed.

However, in a practical setup, the probabilities may have some confidence intervals. So, $$P(A)$$ is actually $$P(A) \pm c_A$$, $$P(B)$$ is actually $$P(B) \pm c_B$$ and $$P(A,B)$$ is actually $$P(A,B) \pm c_{AB}$$ (95% confidence for all variables).

The practical setup that I prefer is the one where we have the original raw data.

When we have only these confidence intervals then this is not a practical setup but a setup with limitations.

You would need to know how these confidence intervals are derived or otherwise assume something and calculate backwards.

I would to this:

1. for each actual observation create two binary variables: happened_a, happened_b;
2. collect a sample
3. Calculate any statistic based on crosstabulations: chi square, or, much better, odds ratio. For these two statistics, formulas to compute confidence intervals for a given confidence level $$\alpha$$ are available also in closed form.
4. If you had chosen, for example, the odds ratio, the two variable would have been defined independent if the odds ratio's confidence interval would not comprehend the one.