Conversation
The sigma (residual variance) sampling had an incorrect parameterization: Before: sigma = 1.0 / Gamma((n+p)/2, scale=1) / err = InvGamma(a,1)/err After: sigma = err / Gamma((n+p)/2, scale=1) = err * InvGamma(a,1) The original PRS-CS (Ge et al., getian107/PRScs) samples sigma as 1/Gamma(a, scale=1/err) = InvGamma(a, rate=err), which has mean err/(a-1). The buggy version gave mean 1/(err*(a-1)), differing by err^2. This caused incorrect posterior variance estimation. Also add a signal recovery test for prs_cs with realistic binomial genotype data and verify sigma is in a reasonable range. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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
src/prscs_mcmc.hline 262)err²vs the original PRS-CS (Ge et al., getian107/PRScs)Bug details
The original PRS-CS samples:
sigma = 1/Gamma((n+p)/2, scale=1/err)=InvGamma(a, rate=err)with meanerr/(a-1).The buggy code had:
sigma = 1.0 / Gamma((n+p)/2, scale=1) / errwhich givesInvGamma(a, rate=1) / errwith mean1/(err*(a-1)). These differ byerr².Fix:
sigma = err / Gamma((n+p)/2, scale=1)which giveserr * InvGamma(a, rate=1)=InvGamma(a, rate=err). ✅Validation
Cross-method benchmark on simulated data (n=1000, p=50, 4 causal SNPs):
PRS-CS stability across 5 seeds: mean cor = 0.92, sd = 0.015. Sigma estimates ~0.95 (reasonable for the simulation).
Test plan
devtools::test(filter="regularized_regression")🤖 Generated with Claude Code