Skip to content

Fix population-label handling in boot.ppfst - #81

Open
thierrygosselin wants to merge 6 commits into
jgx65:masterfrom
thierrygosselin:fix-boot-ppfst-population-labels
Open

thierrygosselin wants to merge 6 commits into
jgx65:masterfrom
thierrygosselin:fix-boot-ppfst-population-labels

Conversation

@thierrygosselin

Copy link
Copy Markdown
Collaborator

Problem

boot.ppfst() uses consecutive integers in its pairwise loop without consistently mapping the input population identifiers to those integers.

Consequently, valid data with population labels such as 10 and 20, or A and B, can fail even though the same genotypes work with labels 1 and 2. Unused factor levels can also introduce nonexistent populations.

Changes

  • Map observed population identifiers to consecutive internal integers.
  • Preserve original identifiers in the output matrices.
  • Retain factor ordering while ignoring unused levels.
  • Reject missing identifiers and fewer than two observed populations.
  • Update documentation and add regression tests.

Validation

All 24 local regression checks passed without warnings.

Tests cover nonconsecutive numeric identifiers, character labels, factor ordering, unused levels, sample-row permutations, and invalid population identifiers.

The original nonconsecutive-label failure was reproduced and corrected. A separate seeded comparison using gtrunchier confirmed unchanged confidence intervals for ordinary input.

Scope

The Weir–Cockerham estimator and locus-bootstrap procedure are unchanged.

This PR addresses population-label handling only. Separate single-locus and array-input problems are outside its scope.

Clarify that confidence-interval row names identify the populations and that single-population input supports numeric, character, and factor identifiers.
Remove the leftover documentation change from master so future branches start without unrelated changes.
Map observed population identifiers to consecutive internal integers before pairwise calculations.

Support nonconsecutive numeric labels, character labels, and factors with unused levels while preserving output population labels.

Reject missing identifiers and fewer than two observed populations explicitly. The estimator and bootstrap procedure remain unchanged.
Test equivalent intervals for consecutive and nonconsecutive numeric labels, character labels, and factors with unused levels.

Verify population-label preservation, factor ordering, and invariance to sample-row order. Check that missing identifiers and fewer than two observed populations produce clear errors.
Document support for numeric, character, and factor population identifiers.

Clarify that identifiers must be non-missing, at least two observed populations are required, and unused factor levels are ignored.
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.

1 participant