Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added mutual information via whichFst #208

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

nspope
Copy link
Contributor

@nspope nspope commented Mar 6, 2019

Added option to calculate the mutual information instead of Fst, as an choice for realSFS fst. MI has nice properties (it is a true metric, it is additive, satisfies triangle inequality etc) which Fst does not. Some prefer MI to Fst for selection scans, demographics, etc. A reference is here.

The MI is calculated with -whichFst 2 flag to realSFS fst index. Here, the numerator is the mutual information, and the denominator is the joint entropy: so the "global" result with realSFS fst stats is the normalized mutual information (aka Shannon differentiation) -- a metric that is bounded in [0,1]. Like with vanilla fst, the print option prints out the numerator (MI) and denominator (joint entropy) per site. Because of the additivity property, the whole weighted vs. unweighted distinction is moot. To avoid redundant code, realSFS fst stats still labels the output as "Fst" even though it is not (and gives meaningless population branch statistics, with three populations). But, the initial realSFS fst index prints a warning to this effect.

I also changed the formatting for realSFS fst print to output numbers with a higher precision and switch to scientific notation if necessary. This avoids annoying round-off errors where both numerator and denominator are small.

Finally, I updated the help message for realSFS fst to reflect these updates and also the other options ... copying from the wiki where possible.

@ANGSD
Copy link
Owner

ANGSD commented May 18, 2020

Hi I am just going through these older pull requests, sorry that i hadnt responded before, i hadnt noticed all these pull requests. Unless you disagree I think this one is still relevant and should also be merged into the master. Sorry about this, it is much appreciated the time you have spent on this.

@nspope
Copy link
Contributor Author

nspope commented May 18, 2020

I think it is still relevant, tho I implemented it for a project that is long since finished. If it seems like a useful feature feel free to merge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants