Skip to content

Stabilize trait correlation across trait scales - #3510

Closed
rpinho wants to merge 2 commits into
tskit-dev:mainfrom
rpinho:fix-trait-correlation-scaling
Closed

rpinho wants to merge 2 commits into
tskit-dev:mainfrom
rpinho:fix-trait-correlation-scaling

Conversation

@rpinho

@rpinho rpinho commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Description

trait_correlation can change when the same phenotype values are expressed in different units. Four trait values spaced one unit apart return a squared correlation of 0.8 at zero offset and NaN after adding 2**27. Rescale and center the weights before calculating the sample variance, and check for constant columns in Python by comparing the values. The Python and C tests check offsets and scales that previously caused loss of precision, overflow or underflow.

Fixes #3495

PR Checklist:

  • Tests that fully cover new/changed functionality.
  • Documentation including tutorial content if appropriate.
  • Changelogs, if there are API changes.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LKxc9GKLwnyeV2jaZBxH9N

@jeromekelleher

Copy link
Copy Markdown
Member

This is the same as #3494, and closing for the same reasons.

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.

overflow in trait_correlation

2 participants