I need a function, which measures, how independent are two random variables.
Ideally,
- It should give 0, if the variables are completely independent ($\rm{P(AB)=P(A)P(B)}$).
- It should give 1, if the variables are completely dependent ($\rm{A=B}$).
Obviously also a reverse result is okay.
After digging the net and my old remembers, I found something like $\rm\frac{P(AB)}{P(A)P(B)}$. This is trivially correct for complete independency. But it gives $\rm\frac{1}{P(A)}$ if $\rm{A=B}$, what is not what I want.
The correlation coëfficient of random variables $\mathbf1_A$ and $\mathbf1_B$ is what comes to mind: $$\rho\left(\mathbf{1}_{A},\mathbf{1}_{B}\right)=\frac{\mathsf{Cov}\left(\mathbf{1}_{A},\mathbf{1}_{B}\right)}{\sqrt{\mathsf{Var}\left(\mathbf{1}_{A}\right)}\sqrt{\mathsf{Var}\left(\mathbf{1}_{B}\right)}}=\frac{P\left(A\cap B\right)-P\left(A\right)P\left(B\right)}{\sqrt{P\left(A\right)\left(1-P\left(A\right)\right)P\left(B\right)\left(1-P\left(B\right)\right)}}$$ Here $\mathbf1_A$ is a random variable that takes value $1$ if $\omega\in A$ (i.e. if event $A$ occurs) and takes value $0$ otherwise.