# Visualizing separability / independence

I’d like to visually ‘see’ the independence of random variables. I tried plotting f(x), f(y), and f(x, y) for independent and dependent pairs of variables. However, the difference is still not apparent to me.

I suppose the problem could be rephrased as: Looking at the graph of a function $$f(x,y)$$, how can you tell if $$f$$ is separable or not?

• It's hard to tell by looking at the graph of $f(x,y).$ Instead, graph $f(y\mid x)$ or $F(y\mid x):$ they will vary with $x$ if and only if $f(x,y)$ is "separable." Another approach is to plot $f(x,y)/(f(x)f(y))$ or its logarithm. Yet another is to plot $\partial^2/\partial x\partial y \log(f(x,y)).$ What you choose will depend on what form $f(x,y)$ is expressed in as well as whether it is known or estimated from data. – whuber Mar 31 at 16:30

## 1 Answer

Some thoughts. You are given a joint density function $$f(x,y)$$ and want to approximate it as best as is possible with a product of densities $$g(x)h(y)$$. So want to solve $$\min_{h,g} \| f(x,y)-g(x)h(y) \|$$ for some norm $$\| \cdot \|$$. There must be many ways to do that, for now I only link to a paper Variational Approximation which might be helpful. An obvious approximation is as the product of the marginals.

Assuming you have found $$h,g$$ solving (at least approximately) that problem, you can simply plot a contour chart (or perspective chart) of the difference $$f(x,y)-g(x)h(y)$$, or better, the ratio $$F(x,y)/(g(x)h(y)$$.

Examples of such plots van be found in Infinitesimal independence

• Could you explain what one would be looking for in such a chart? It isn't clear what information about the original question would be provided by producing such a solution to the minimization problem you pose. Either the approximation is perfect, the minimum is zero, and the variables are independent; or else it is not perfect, the minimum is nonzero, and the variables are not independent. Also, what meaning would the ratio $F/(gh)$ have where (apparently) $F$ is a CDF and $g$ and $h$ are PDFs? – whuber Apr 3 at 16:52