Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions tests/testthat/test-bgm-delta.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ test_that("delta > 0 shifts NUTS K_ii posterior mean upward (GGM)", {
base = bgm(
x, variable_type = "continuous",
iter = 300L, warmup = 300L, chains = 1L,
edge_selection = FALSE, verbose = FALSE, seed = 2L,
edge_selection = FALSE, verbose = FALSE, display_progress = "none", seed = 2L,
delta = 0
)
tilted = bgm(
x, variable_type = "continuous",
iter = 300L, warmup = 300L, chains = 1L,
edge_selection = FALSE, verbose = FALSE, seed = 2L,
edge_selection = FALSE, verbose = FALSE, display_progress = "none", seed = 2L,
delta = 5
)
expect_gt(trace_K(tilted), trace_K(base))
Expand All @@ -52,14 +52,14 @@ test_that("delta > 0 shifts MH K_ii posterior mean upward (GGM)", {
x, variable_type = "continuous",
update_method = "adaptive-metropolis",
iter = 400L, warmup = 400L, chains = 1L,
edge_selection = FALSE, verbose = FALSE, seed = 3L,
edge_selection = FALSE, verbose = FALSE, display_progress = "none", seed = 3L,
delta = 0
)
tilted = bgm(
x, variable_type = "continuous",
update_method = "adaptive-metropolis",
iter = 400L, warmup = 400L, chains = 1L,
edge_selection = FALSE, verbose = FALSE, seed = 3L,
edge_selection = FALSE, verbose = FALSE, display_progress = "none", seed = 3L,
delta = 5
)
expect_gt(trace_K(tilted), trace_K(base))
Expand All @@ -75,7 +75,7 @@ test_that("delta > 0 is rejected for pure-ordinal models", {
bgm(
x, variable_type = "ordinal",
iter = 20L, warmup = 20L, chains = 1L,
edge_selection = FALSE, verbose = FALSE,
edge_selection = FALSE, verbose = FALSE, display_progress = "none",
delta = 1
),
"no precision matrix to tilt"
Expand All @@ -89,23 +89,23 @@ test_that("invalid delta values are rejected with a clear message", {
bgm(
x, variable_type = "continuous",
iter = 20L, warmup = 20L, chains = 1L,
verbose = FALSE, delta = -1
verbose = FALSE, display_progress = "none", delta = -1
),
"non-negative"
)
expect_error(
bgm(
x, variable_type = "continuous",
iter = 20L, warmup = 20L, chains = 1L,
verbose = FALSE, delta = NA_real_
verbose = FALSE, display_progress = "none", delta = NA_real_
),
"finite"
)
expect_error(
bgm(
x, variable_type = "continuous",
iter = 20L, warmup = 20L, chains = 1L,
verbose = FALSE, delta = c(0, 1)
verbose = FALSE, display_progress = "none", delta = c(0, 1)
),
"single"
)
Expand Down
12 changes: 10 additions & 2 deletions tests/testthat/test-scaling-diagnostics.R
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,12 @@ test_that("S.M3: Mixed NUTS healthy at p=7, q=5 with edge selection", {
display_progress = "none", seed = 3013
)

check_nuts_health(fit, "S.M3")
# Rhat limit relaxed to 1.17 (vs the default 1.10): posterior_summary_pairwise
# is the max classic Gelman-Rubin Rhat over all 66 edge-selected interaction
# coefficients, each a spike-and-slab (0/value) sequence. Since the marginal-PL
# correctness fix (#97) the corrected target sits at ~1.16 here; the other
# health checks (divergences, E-BFMI, tree depth, ESS) stay strict.
check_nuts_health(fit, "S.M3", rhat_max = 1.17)
})

test_that("S.M4: Mixed NUTS healthy at p=5, q=3, marginal PL", {
Expand All @@ -310,7 +315,10 @@ test_that("S.M4: Mixed NUTS healthy at p=5, q=3, marginal PL", {
display_progress = "none", seed = 3014
)

check_nuts_health(fit, "S.M4")
# Rhat limit relaxed to 1.17 (vs the default 1.10): same rationale as S.M3 --
# max GR Rhat over edge-selected spike-and-slab pairwise coefficients, shifted
# by the #97 marginal-PL correctness fix. Other health checks stay strict.
check_nuts_health(fit, "S.M4", rhat_max = 1.17)
})

test_that("S.M5: Mixed NUTS survives near-singular Kyy", {
Expand Down
Loading