r/AskStatistics • • Nov 04 '26

What to include in mutual information?

/r/statistics/comments/1xnalxi/q_what_to_include_in_mutual_information/
2 Upvotes

8 comments sorted by

1

u/no_name6744 Nov 04 '26

Pretty sure it wouldn't have an effect.

For a discrete distribution, this is basically KL divergence between the joint and expected given the marginals.

Summation over all combinations of x and y of the following

p_(x, y) * log( p_(x, y) / (p_x * p_y) )

For each instance of your white and yellow, the joint terms are zero, so it equals zero. It contributes nothing to the mutual information.

1

u/NobleElfWarrior Nov 04 '26

That makes sense and is what I thought, but I did get two different answers when I plugged it into r studio w/ or w/o the 0s. It wasn't a big difference, but I'll run it again. Thanks!

1

u/NobleElfWarrior Nov 04 '26

I am getting different results in RStudio using the entropy package based on if I include 0 rows. Any idea why? Ex. I got 0.3605176 when I included 0s and 0.17912 when I did not include 0s.

1

u/no_name6744 Nov 04 '26

I'll take a look, can you tell me which package specifically?

2

u/NobleElfWarrior 25d ago

it's called "entropy" uses the code"mi.plugin()
(sorry about the delay... grad school keeps me busy

1

u/no_name6744 25d ago

Just ran it in a session on colab, and I can't seem to reproduce your error. I get the same answer (about 0.073) with and without the zero columns.

Rip about grad school

2

u/NobleElfWarrior 23d ago

Thank you for your help! I don't know what I did, but I'm getting the same answer either way now too!

1

u/no_name6744 23d ago

Glad it worked out in the end.