Use an unambiguous missing-value sentinel in marker regressions - #111
Open
thierrygosselin wants to merge 1 commit into
Open
thierrygosselin wants to merge 1 commit into
thierrygosselin wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR prevents legitimate standardized genotype values equal to
3from being mistaken for missing genotypes during marker-level regression.Problem
multLinReg()currently constructs a scaled genotype accessor using3as its missing-value sentinel:It then detects missing observations with:
not_missing[i] = (x[i] != 3);However,
x[i]is no longer a raw genotype. It is the centred and scaled genotype value:A legitimate observed genotype can therefore equal
3.For diploid data, an alternate homozygote at allele frequency
p = 2/11gives exactly:This frequency is realizable, for example, with four alternate alleles among 22 observed chromosomes.
The affected alternate homozygotes are consequently removed from the marker regression as though their genotypes were missing.
Demonstrated effect
Using 11 diploid individuals with two observed alternate homozygotes and nine reference homozygotes gives an allele frequency of
2/11.In a controlled two-component example, the current sentinel collision changed the marker statistics from:
to:
Both component statistics changed substantially and reversed sign.
Changes
3.NumericVector::is_na().p = 2/11collision.Scope
This PR only corrects the ambiguous sentinel.
It does not change the statistical treatment of missing genotypes or resolve the separate question of whether marker-specific regression should use the full cross-product matrix of the observed PC scores.
Validation
R CMD check --no-manual: 0 errors, 0 warnings and 0 notes when unavailable suggested packages were not forced.