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

Weighted KDE frequencies do not sum to 1 when representative weight attributes are missing #268

Closed
huddlej opened this issue Apr 3, 2019 · 0 comments · Fixed by #420
Closed
Assignees
Labels
bug Something isn't working

Comments

@huddlej
Copy link
Contributor

huddlej commented Apr 3, 2019

This bug occurred when building a tree of full-length HA sequences for the years 2000 through 2004 with frequencies weighted by region (e.g., Africa, South Asia, etc.). I noticed that the frequencies for the last pivot in 2004 did not sum to 100% but instead to ~60%. On inspection, there were no samples in this tree from Africa, South Asia, or South America. The proportion of total weight contributed by these regions is about 40%. The resulting frequency panel looked like the following:

image

This bug indicates that tip frequencies need to be renormalized to sum to 100% after their initial normalization to the proportions associated with each region to account for cases when not all regions are present in the tree.

@huddlej huddlej added the bug Something isn't working label Apr 3, 2019
huddlej added a commit that referenced this issue Nov 26, 2019
Fixes a bug in weighted KDE estimation of tree frequencies when one or more
weight attributes is not represented by any tips on the tree. For example, when
a tree is missing any samples from Africa but the frequencies are being weighted
by region, the total of the estimated frequencies will not sum to 1.

This commit adds unit tests to confirm the original issue and adds logic to KDE
frequency estimation to correct the issue.

Closes #268.
@huddlej huddlej self-assigned this Dec 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
1 participant