Accept a Cauchy slab under the hierarchical spec; rename graph_prior_spec#159
Merged
Conversation
The eligibility check rejected every slab except the normal, but the Cauchy slab is a scale mixture of normals: conditional on the per-edge mixture weight it is a normal slab, so the Z-ratio normalizer applies unchanged. The Gibbs edge move already conditions on the weights, and the Metropolis and NUTS between-edge moves evaluate the marginal Cauchy density, which integrates the weights out; all three samplers target the same posterior. On a synthetic check their inclusion probabilities agree to within Monte Carlo noise (max difference 0.009 across methods and edges). The eligibility messages now name the received prior and the supported alternatives.
The argument selects how the prior on the continuous precision block composes with the graph: a joint spike-and-slab prior on (K, Gamma) or the hierarchical factorization p(Gamma) p(K | Gamma). The old name read as configuring the prior on the graph itself, which is edge_prior's role. The argument has not appeared in a CRAN release, so the rename carries no deprecation shim. Also updates the prior-chain eligibility test for the Cauchy slab now being accepted.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #159 +/- ##
===========================================
- Coverage 91.23% 91.13% -0.11%
===========================================
Files 103 103
Lines 14520 14516 -4
===========================================
- Hits 13248 13229 -19
- Misses 1272 1287 +15 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
The rename commit reformatted these files with the default styler settings (<- assignment, space after if). Reapply the package styler configuration so they use = assignment and no space after if, matching the rest of the codebase.
…ssage The eligibility error for an unsupported interaction prior explained that the normalizer is derived for the normal slab and that the Cauchy slab enters through its scale mixture of normals. That describes the internal representation rather than what the user should do, so state only that a normal or Cauchy slab is supported. Same change in bgm(), sample_ggm_prior(), and the bgm() documentation.
The energy-stationarity warmup check is a heuristic, and its message went straight to "increase warmup". The lower-severity divergence and tree-depth lines instead point the user at R-hat and ESS. Align the warmup line with them: report that warmup may be incomplete and direct the user to check R-hat and ESS rather than prescribing a change.
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.
Two related fixes to the hierarchical precision-graph prior for continuous (GGM) and mixed models.
Accept a Cauchy slab
bgm(x, variable_type = "continuous", graph_prior_spec = "hierarchical")errored with a message demanding a normal interaction prior, even though the default interaction prior is Cauchy. The block was left over from when the Z-ratio normalizer was only derived for the normal slab.The Cauchy slab is a scale mixture of normals: Cauchy(k; 0, σ) = ∫ N(k; 0, σ²ω) InvGamma(ω; ½, ½) dω. The ω-augmented conjugate move (Gibbs) and the marginal-density moves (adaptive-Metropolis, NUTS) target the same K-marginal, and the Z surrogate is ω-free, so the same normalizer serves all three update methods. The eligibility guard now accepts a normal or a Cauchy interaction prior; no sampler change was needed.
Verified with cross-method inclusion-probability agreement (max difference 0.009 across all edges at q = 6, n = 400) and a new test that fits the spec under each update method.
Clearer, less vague messages
The eligibility errors now name the prior that was supplied and the supported alternatives, and point at
graph_prior_spec = "joint"as the fallback, instead of stating a bare requirement.Rename graph_prior_spec to precision_graph_prior
The argument selects how the prior on the continuous precision block composes with the graph: a joint spike-and-slab prior on (K, Γ), or the hierarchical factorization p(Γ) p(K | Γ). The old name read as configuring the prior on the graph, which is
edge_prior's role. The argument has not appeared in a CRAN release, so there is no deprecation shim.The rename covers
bgm(),bgm_spec(), the stored@argumentsfield,NEWS.md, the roxygen and regeneratedman/bgm.Rd, and the tests.sample_ggm_prior()keeps its own shortspecargument.Checks
Targeted tests pass (hierarchical-spec 32/32 including the three-method Cauchy fit, prior-chain identity 8/8, build-arguments field list).
R CMD check --as-cran: 0 errors, 0 warnings, 2 environmental NOTEs.