From 2dee3c0b48d968338c2bbfc7945106e89d258d38 Mon Sep 17 00:00:00 2001 From: Maarten Marsman Date: Thu, 5 Nov 2026 16:33:31 +0100 Subject: [PATCH 1/4] fix(summary): leave the directional flip counts out of the printed inclusion table print.summary.bgms() and print.summary.bgmCompare() print the inclusion table without the n0->1 and n1->0 columns. The columns stay in summary(fit)$indicator and every extractor. Snapshot and NEWS follow. --- NEWS.md | 4 ++++ R/methods_bgmcompare.R | 7 ++++--- R/methods_bgms.R | 7 ++++--- tests/testthat/_snaps/summary-marking.md | 2 +- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/NEWS.md b/NEWS.md index ae5edc5c..dfb215c5 100644 --- a/NEWS.md +++ b/NEWS.md @@ -165,6 +165,10 @@ released from this line yet. ## Diagnostics +* The printed `summary()` of a `bgm()` or `bgmCompare()` fit no longer shows + the directional flip counts `n0->1` and `n1->0` in its inclusion table. The + columns stay in `summary(fit)$indicator`. + * The `summary()` tables and `prior_sensitivity_check()` no longer substitute values for a Monte Carlo error or a convergence diagnostic that was not computed. An indicator whose inclusion probability was 0 or 1 in every draw diff --git a/R/methods_bgmcompare.R b/R/methods_bgmcompare.R index 0cb438c9..aec82921 100644 --- a/R/methods_bgmcompare.R +++ b/R/methods_bgmcompare.R @@ -327,10 +327,11 @@ print.summary.bgmCompare = function(x, digits = 3, ...) { if(!is.null(x$indicator)) { cat("Inclusion probabilities:\n") - # mean/mcse/sd/n_eff/Rhat are the Rao-Blackwellized inclusion estimate; - # n0->1 / n1->0 are the raw directional flip counts, which record the - # indicator's exploration beside them. + # mean/mcse/sd/n_eff/Rhat are the Rao-Blackwellized inclusion estimate. The + # directional flip counts n0->1 / n1->0 stay in summary(fit)$indicator and + # are not printed. ind = head(x$indicator, 6) + ind = ind[, setdiff(names(ind), c("n0->1", "n1->0")), drop = FALSE] ind_has_na = anyNA(ind) diff --git a/R/methods_bgms.R b/R/methods_bgms.R index 520d890d..e3d86efe 100644 --- a/R/methods_bgms.R +++ b/R/methods_bgms.R @@ -179,10 +179,11 @@ print.summary.bgms = function(x, digits = 3, ...) { if(!is.null(x$indicator)) { cat("Inclusion probabilities:\n") - # mean/mcse/sd/n_eff/Rhat are the Rao-Blackwellized inclusion estimate; - # n0->1 / n1->0 are the raw directional flip counts, which record the - # indicator's exploration beside them. + # mean/mcse/sd/n_eff/Rhat are the Rao-Blackwellized inclusion estimate. The + # directional flip counts n0->1 / n1->0 stay in summary(fit)$indicator and + # are not printed. ind = head(x$indicator, .summary_preview_rows) + ind = ind[, setdiff(names(ind), c("n0->1", "n1->0")), drop = FALSE] ind_has_na = anyNA(ind) ind[] = lapply(ind, function(col) ifelse(is.na(col), "", round(col, digits))) print(ind) diff --git a/tests/testthat/_snaps/summary-marking.md b/tests/testthat/_snaps/summary-marking.md index f288cedf..e666f460 100644 --- a/tests/testthat/_snaps/summary-marking.md +++ b/tests/testthat/_snaps/summary-marking.md @@ -24,7 +24,7 @@ B-C Inclusion probabilities: - parameter mean mcse sd n_eff Rhat n0->1 n1->0 + parameter mean mcse sd n_eff Rhat A (main) A-B (pairwise) A-C (pairwise) From 4b3caae15cbe087949fa3bff0b8c9c495dca00a5 Mon Sep 17 00:00:00 2001 From: Maarten Marsman Date: Thu, 5 Nov 2026 16:35:13 +0100 Subject: [PATCH 2/4] fix(verdicts): close the printed table with the robust count, then the near-threshold count print.bgms_verdicts() prints, for the indicators that carry a verdict, how many lie far enough from an evidence threshold that Monte Carlo error does not move them, then how many lie within two standard errors of one with the remedy of a longer run; with none flagged the line says so. This replaces the "Monte-Carlo fragile" warning that appeared only when some verdict was flagged. The fragile column and the returned object are unchanged; its documentation names it the near-threshold flag. Snapshot, tests and NEWS follow. --- NEWS.md | 6 ++++++ R/verdicts.R | 34 +++++++++++++++++++++++-------- man/print.bgms_verdicts.Rd | 4 +++- man/verdicts.Rd | 3 ++- tests/testthat/_snaps/verdicts.md | 12 +++++------ tests/testthat/test-verdicts.R | 17 ++++++++++------ 6 files changed, 54 insertions(+), 22 deletions(-) diff --git a/NEWS.md b/NEWS.md index dfb215c5..3b8a6568 100644 --- a/NEWS.md +++ b/NEWS.md @@ -169,6 +169,12 @@ released from this line yet. the directional flip counts `n0->1` and `n1->0` in its inclusion table. The columns stay in `summary(fit)$indicator`. +* The printed `verdicts()` table closes with the robust count first: how many + verdicts lie far enough from an evidence threshold that Monte Carlo error + does not move them, then how many lie within two standard errors of one. The + line replaces the "Monte-Carlo fragile" warning, which appeared only when some + verdict was flagged. The `fragile` column is unchanged. + * The `summary()` tables and `prior_sensitivity_check()` no longer substitute values for a Monte Carlo error or a convergence diagnostic that was not computed. An indicator whose inclusion probability was 0 or 1 in every draw diff --git a/R/verdicts.R b/R/verdicts.R index f728c65f..4102580a 100644 --- a/R/verdicts.R +++ b/R/verdicts.R @@ -275,7 +275,8 @@ build_verdicts = function(parameter, log_bf, pip, mcse, draws, evidence_threshol #' where the Rao-Blackwellized draws are constant to double precision.} #' \item{distance_two_state, distance_rb}{Distance from `log_bf` to the #' nearer verdict boundary, in units of each standard error.} -#' \item{fragile}{`TRUE` when either distance is below 2.} +#' \item{fragile}{`TRUE` when either distance is below 2: the +#' near-threshold flag.} #' } #' The evidence threshold is attached as the `evidence_threshold` attribute, #' and whether the fragility flag's operating point covers this kind of @@ -442,7 +443,9 @@ check_evidence_threshold = function(evidence_threshold) { #' #' @description #' Prints the verdict tally, the leading rows of the verdict table, and a -#' warning line when any verdict is Monte-Carlo fragile. +#' line giving how many verdicts lie far enough from an evidence threshold that +#' Monte Carlo error does not move them and how many lie within two standard +#' errors of one (the `fragile` column, the near-threshold flag). #' #' @param x An object of class `bgms_verdicts`, from [verdicts()]. #' @param digits Number of digits for the printed numeric columns. Default `3`. @@ -519,12 +522,27 @@ print.bgms_verdicts = function(x, digits = 3, max_rows = 10L, ...) { cat(sprintf("... (%d more rows)\n", nrow(rows) - max_rows)) } - n_fragile = sum(rows$fragile) - if(n_fragile > 0) { - cat(sprintf( - "\n%d %s Monte-Carlo fragile: a verdict boundary lies within two standard\nerrors of the evidence, so the verdict could change on a rerun. Consider a\nlonger run.\n", - n_fragile, if(n_fragile == 1L) "verdict is" else "verdicts are" - )) + # The robust count first, then the near-threshold exception, over the + # indicators that carry a verdict. + fragile = rows$fragile %in% TRUE + n_robust = sum(!fragile & !is.na(rows$verdict)) + n_fragile = sum(fragile) + if(n_robust + n_fragile > 0) { + first = sprintf( + "%d %s far enough from an evidence threshold that Monte Carlo error does not move %s.", + n_robust, if(n_robust == 1L) "verdict lies" else "verdicts lie", + if(n_robust == 1L) "it" else "them" + ) + second = if(n_fragile == 0L) { + "None lies within two standard errors of one." + } else { + sprintf( + "%d %s within two standard errors of one, so a rerun could change %s; a longer run settles %s.", + n_fragile, if(n_fragile == 1L) "lies" else "lie", + if(n_fragile == 1L) "it" else "those", if(n_fragile == 1L) "it" else "them" + ) + } + cat("\n", paste(strwrap(paste(first, second), width = 80), collapse = "\n"), "\n", sep = "") } # The flag's operating point was established on single-network edge # indicators. Borrowing those numbers for difference indicators would report a diff --git a/man/print.bgms_verdicts.Rd b/man/print.bgms_verdicts.Rd index 3266781d..547c1c3f 100644 --- a/man/print.bgms_verdicts.Rd +++ b/man/print.bgms_verdicts.Rd @@ -20,7 +20,9 @@ } \description{ Prints the verdict tally, the leading rows of the verdict table, and a -warning line when any verdict is Monte-Carlo fragile. +line giving how many verdicts lie far enough from an evidence threshold that +Monte Carlo error does not move them and how many lie within two standard +errors of one (the \code{fragile} column, the near-threshold flag). } \seealso{ \code{\link[=verdicts]{verdicts()}} diff --git a/man/verdicts.Rd b/man/verdicts.Rd index 66370809..27f2df9d 100644 --- a/man/verdicts.Rd +++ b/man/verdicts.Rd @@ -36,7 +36,8 @@ indicator chain and from the Rao-Blackwellized draws. \code{se_rb} is \code{NA} where the Rao-Blackwellized draws are constant to double precision.} \item{distance_two_state, distance_rb}{Distance from \code{log_bf} to the nearer verdict boundary, in units of each standard error.} -\item{fragile}{\code{TRUE} when either distance is below 2.} +\item{fragile}{\code{TRUE} when either distance is below 2: the +near-threshold flag.} } The evidence threshold is attached as the \code{evidence_threshold} attribute, and whether the fragility flag's operating point covers this kind of diff --git a/tests/testthat/_snaps/verdicts.md b/tests/testthat/_snaps/verdicts.md index 24f3c358..a3328501 100644 --- a/tests/testthat/_snaps/verdicts.md +++ b/tests/testthat/_snaps/verdicts.md @@ -14,9 +14,9 @@ A-C (pairwise) 0.10 -2.20 undecided TRUE B-C (pairwise) 0.52 0.08 undecided FALSE - 1 verdict is Monte-Carlo fragile: a verdict boundary lies within two standard - errors of the evidence, so the verdict could change on a rerun. Consider a - longer run. + 2 verdicts lie far enough from an evidence threshold that Monte Carlo error + does not move them. 1 lies within two standard errors of one, so a rerun could + change it; a longer run settles it. The fragility flag is not validated for difference indicators: its operating point was established on single-network edge indicators only. @@ -46,9 +46,9 @@ B-C (pairwise) 0.52 0.08 undecided FALSE C (main) 0.50 0.00 undecided FALSE - 1 verdict is Monte-Carlo fragile: a verdict boundary lies within two standard - errors of the evidence, so the verdict could change on a rerun. Consider a - longer run. + 5 verdicts lie far enough from an evidence threshold that Monte Carlo error + does not move them. 1 lies within two standard errors of one, so a rerun could + change it; a longer run settles it. The fragility flag is not validated for difference indicators: its operating point was established on single-network edge indicators only. diff --git a/tests/testthat/test-verdicts.R b/tests/testthat/test-verdicts.R index a85de48a..4f59ea08 100644 --- a/tests/testthat/test-verdicts.R +++ b/tests/testthat/test-verdicts.R @@ -238,16 +238,21 @@ test_that("print.bgms_verdicts tallies verdicts and warns once when fragile", { expect_match(out, "15 indicators") # Edge indicators are what the flag was calibrated on, so no caveat here. expect_false(grepl("not validated", out)) + # The robust count comes first; the near-threshold count follows it. + expect_match(out, "far enough from an evidence threshold that Monte Carlo") if(any(v$fragile)) { - expect_match(out, "Monte-Carlo fragile") - expect_match(out, "Consider a") + expect_match(out, sprintf("%d (lies|lie) within two standard errors of one", sum(v$fragile))) + expect_match(out, "a longer run settles") } - # No fragile edges, no advice line. + # No fragile edges: the robust count covers every verdict, and the line says + # that none lies near a threshold. v_none = v v_none$fragile = rep(FALSE, nrow(v)) quiet = paste(utils::capture.output(print(v_none)), collapse = "\n") - expect_false(grepl("Monte-Carlo fragile", quiet)) + expect_match(quiet, sprintf("%d verdicts lie far enough", sum(!is.na(v$verdict)))) + expect_match(quiet, "None lies within two standard errors of one") + expect_false(grepl("longer run", quiet)) # Selecting columns keeps the class but not the table; printing what is left # must degrade to the plain data frame rather than fail on a missing column. @@ -398,8 +403,8 @@ test_that("the compare print tabulates selected main differences as rows", { expect_snapshot(print(make_compare_verdicts(main_selected = TRUE))) }) -test_that("the fragility footer suggests a longer run without commanding one", { +test_that("the fragility footer states the remedy without commanding one", { out = capture.output(print(make_compare_verdicts(main_selected = FALSE))) - expect_true(any(grepl("Consider a", out))) + expect_true(any(grepl("a longer run settles", out))) expect_false(any(grepl("Run longer", out))) }) From e6b1ba85ba457d3721d55f0044411bc9071e1e91 Mon Sep 17 00:00:00 2001 From: Maarten Marsman Date: Thu, 5 Nov 2026 22:57:42 +0100 Subject: [PATCH 3/4] fix(print): clarify Monte Carlo uncertainty in verdict summaries --- NEWS.md | 11 ++++++----- R/verdicts.R | 22 +++++++++++----------- man/print.bgms_verdicts.Rd | 7 ++++--- tests/testthat/_snaps/verdicts.md | 14 ++++++++------ tests/testthat/test-verdicts.R | 25 ++++++++++++------------- 5 files changed, 41 insertions(+), 38 deletions(-) diff --git a/NEWS.md b/NEWS.md index 3b8a6568..213297f0 100644 --- a/NEWS.md +++ b/NEWS.md @@ -169,11 +169,12 @@ released from this line yet. the directional flip counts `n0->1` and `n1->0` in its inclusion table. The columns stay in `summary(fit)$indicator`. -* The printed `verdicts()` table closes with the robust count first: how many - verdicts lie far enough from an evidence threshold that Monte Carlo error - does not move them, then how many lie within two standard errors of one. The - line replaces the "Monte-Carlo fragile" warning, which appeared only when some - verdict was flagged. The `fragile` column is unchanged. +* The printed `verdicts()` table closes with the number of verdicts not flagged + as sensitive to Monte Carlo error, followed by the number flagged because + their estimated log Bayes factors lie within two standard errors of an + evidence threshold. The text replaces the "Monte-Carlo fragile" warning, + which appeared only when some verdict was flagged, and suggests that a longer + run may help resolve the uncertainty. The `fragile` column is unchanged. * The `summary()` tables and `prior_sensitivity_check()` no longer substitute values for a Monte Carlo error or a convergence diagnostic that was not diff --git a/R/verdicts.R b/R/verdicts.R index 4102580a..7d7e44b2 100644 --- a/R/verdicts.R +++ b/R/verdicts.R @@ -443,9 +443,10 @@ check_evidence_threshold = function(evidence_threshold) { #' #' @description #' Prints the verdict tally, the leading rows of the verdict table, and a -#' line giving how many verdicts lie far enough from an evidence threshold that -#' Monte Carlo error does not move them and how many lie within two standard -#' errors of one (the `fragile` column, the near-threshold flag). +#' line giving the number of verdicts not flagged as sensitive to Monte Carlo +#' error, followed by the number flagged because their estimated log Bayes +#' factors lie within two standard errors of an evidence threshold (the +#' `fragile` column). #' #' @param x An object of class `bgms_verdicts`, from [verdicts()]. #' @param digits Number of digits for the printed numeric columns. Default `3`. @@ -522,24 +523,23 @@ print.bgms_verdicts = function(x, digits = 3, max_rows = 10L, ...) { cat(sprintf("... (%d more rows)\n", nrow(rows) - max_rows)) } - # The robust count first, then the near-threshold exception, over the + # The unflagged count first, then the near-threshold count, over the # indicators that carry a verdict. fragile = rows$fragile %in% TRUE n_robust = sum(!fragile & !is.na(rows$verdict)) n_fragile = sum(fragile) if(n_robust + n_fragile > 0) { first = sprintf( - "%d %s far enough from an evidence threshold that Monte Carlo error does not move %s.", - n_robust, if(n_robust == 1L) "verdict lies" else "verdicts lie", - if(n_robust == 1L) "it" else "them" + "%d %s not flagged as sensitive to Monte Carlo error.", + n_robust, if(n_robust == 1L) "verdict is" else "verdicts are" ) second = if(n_fragile == 0L) { - "None lies within two standard errors of one." + "None of the estimated log Bayes factors is flagged as being within two standard errors of an evidence threshold." } else { sprintf( - "%d %s within two standard errors of one, so a rerun could change %s; a longer run settles %s.", - n_fragile, if(n_fragile == 1L) "lies" else "lie", - if(n_fragile == 1L) "it" else "those", if(n_fragile == 1L) "it" else "them" + "%d %s could change on a rerun: %s within two standard errors of an evidence threshold. A longer run may help resolve this uncertainty.", + n_fragile, if(n_fragile == 1L) "verdict" else "verdicts", + if(n_fragile == 1L) "its estimated log Bayes factor lies" else "their estimated log Bayes factors lie" ) } cat("\n", paste(strwrap(paste(first, second), width = 80), collapse = "\n"), "\n", sep = "") diff --git a/man/print.bgms_verdicts.Rd b/man/print.bgms_verdicts.Rd index 547c1c3f..66ec333b 100644 --- a/man/print.bgms_verdicts.Rd +++ b/man/print.bgms_verdicts.Rd @@ -20,9 +20,10 @@ } \description{ Prints the verdict tally, the leading rows of the verdict table, and a -line giving how many verdicts lie far enough from an evidence threshold that -Monte Carlo error does not move them and how many lie within two standard -errors of one (the \code{fragile} column, the near-threshold flag). +line giving the number of verdicts not flagged as sensitive to Monte Carlo +error, followed by the number flagged because their estimated log Bayes +factors lie within two standard errors of an evidence threshold (the +\code{fragile} column). } \seealso{ \code{\link[=verdicts]{verdicts()}} diff --git a/tests/testthat/_snaps/verdicts.md b/tests/testthat/_snaps/verdicts.md index a3328501..da267e1e 100644 --- a/tests/testthat/_snaps/verdicts.md +++ b/tests/testthat/_snaps/verdicts.md @@ -14,9 +14,10 @@ A-C (pairwise) 0.10 -2.20 undecided TRUE B-C (pairwise) 0.52 0.08 undecided FALSE - 2 verdicts lie far enough from an evidence threshold that Monte Carlo error - does not move them. 1 lies within two standard errors of one, so a rerun could - change it; a longer run settles it. + 2 verdicts are not flagged as sensitive to Monte Carlo error. 1 verdict could + change on a rerun: its estimated log Bayes factor lies within two standard + errors of an evidence threshold. A longer run may help resolve this + uncertainty. The fragility flag is not validated for difference indicators: its operating point was established on single-network edge indicators only. @@ -46,9 +47,10 @@ B-C (pairwise) 0.52 0.08 undecided FALSE C (main) 0.50 0.00 undecided FALSE - 5 verdicts lie far enough from an evidence threshold that Monte Carlo error - does not move them. 1 lies within two standard errors of one, so a rerun could - change it; a longer run settles it. + 5 verdicts are not flagged as sensitive to Monte Carlo error. 1 verdict could + change on a rerun: its estimated log Bayes factor lies within two standard + errors of an evidence threshold. A longer run may help resolve this + uncertainty. The fragility flag is not validated for difference indicators: its operating point was established on single-network edge indicators only. diff --git a/tests/testthat/test-verdicts.R b/tests/testthat/test-verdicts.R index 4f59ea08..2163de91 100644 --- a/tests/testthat/test-verdicts.R +++ b/tests/testthat/test-verdicts.R @@ -233,25 +233,24 @@ test_that("print.bgms_verdicts tallies verdicts and warns once when fragile", { fit = get_bgms_fit_wenchuan6() v = verdicts(fit) - out = paste(utils::capture.output(print(v)), collapse = "\n") + out = gsub("\\s+", " ", paste(utils::capture.output(print(v)), collapse = " ")) expect_match(out, "presence \\d+ \\| undecided \\d+ \\| absence \\d+") expect_match(out, "15 indicators") # Edge indicators are what the flag was calibrated on, so no caveat here. expect_false(grepl("not validated", out)) - # The robust count comes first; the near-threshold count follows it. - expect_match(out, "far enough from an evidence threshold that Monte Carlo") + # The unflagged count comes first; the near-threshold count follows it. + expect_match(out, "not flagged as sensitive to Monte Carlo error") if(any(v$fragile)) { - expect_match(out, sprintf("%d (lies|lie) within two standard errors of one", sum(v$fragile))) - expect_match(out, "a longer run settles") + expect_match(out, sprintf("%d verdicts? could change on a rerun", sum(v$fragile))) + expect_match(out, "A longer run may help resolve this uncertainty") } - # No fragile edges: the robust count covers every verdict, and the line says - # that none lies near a threshold. + # No fragile edges: every verdict is counted as unflagged. v_none = v v_none$fragile = rep(FALSE, nrow(v)) - quiet = paste(utils::capture.output(print(v_none)), collapse = "\n") - expect_match(quiet, sprintf("%d verdicts lie far enough", sum(!is.na(v$verdict)))) - expect_match(quiet, "None lies within two standard errors of one") + quiet = gsub("\\s+", " ", paste(utils::capture.output(print(v_none)), collapse = " ")) + expect_match(quiet, sprintf("%d verdicts are not flagged", sum(!is.na(v$verdict)))) + expect_match(quiet, "None of the estimated log Bayes factors is flagged as being within two standard errors of an evidence threshold") expect_false(grepl("longer run", quiet)) # Selecting columns keeps the class but not the table; printing what is left @@ -403,8 +402,8 @@ test_that("the compare print tabulates selected main differences as rows", { expect_snapshot(print(make_compare_verdicts(main_selected = TRUE))) }) -test_that("the fragility footer states the remedy without commanding one", { - out = capture.output(print(make_compare_verdicts(main_selected = FALSE))) - expect_true(any(grepl("a longer run settles", out))) +test_that("the fragility footer suggests a longer run without promising resolution", { + out = gsub("\\s+", " ", paste(capture.output(print(make_compare_verdicts(main_selected = FALSE))), collapse = " ")) + expect_true(any(grepl("A longer run may help resolve this uncertainty", out))) expect_false(any(grepl("Run longer", out))) }) From cd98152dc0304eccf10dcc307c4b2e3c26bc44bc Mon Sep 17 00:00:00 2001 From: Maarten Marsman Date: Thu, 5 Nov 2026 23:02:07 +0100 Subject: [PATCH 4/4] fix(print): describe verdicts as appearing robust to Monte Carlo error --- NEWS.md | 4 ++-- R/verdicts.R | 6 +++--- man/print.bgms_verdicts.Rd | 2 +- tests/testthat/_snaps/verdicts.md | 14 ++++++-------- tests/testthat/test-verdicts.R | 4 ++-- 5 files changed, 14 insertions(+), 16 deletions(-) diff --git a/NEWS.md b/NEWS.md index 213297f0..5c86bb56 100644 --- a/NEWS.md +++ b/NEWS.md @@ -169,8 +169,8 @@ released from this line yet. the directional flip counts `n0->1` and `n1->0` in its inclusion table. The columns stay in `summary(fit)$indicator`. -* The printed `verdicts()` table closes with the number of verdicts not flagged - as sensitive to Monte Carlo error, followed by the number flagged because +* The printed `verdicts()` table closes with the number of verdicts that appear + robust to Monte Carlo error, followed by the number flagged because their estimated log Bayes factors lie within two standard errors of an evidence threshold. The text replaces the "Monte-Carlo fragile" warning, which appeared only when some verdict was flagged, and suggests that a longer diff --git a/R/verdicts.R b/R/verdicts.R index 7d7e44b2..098c3c7c 100644 --- a/R/verdicts.R +++ b/R/verdicts.R @@ -443,7 +443,7 @@ check_evidence_threshold = function(evidence_threshold) { #' #' @description #' Prints the verdict tally, the leading rows of the verdict table, and a -#' line giving the number of verdicts not flagged as sensitive to Monte Carlo +#' line giving the number of verdicts that appear robust to Monte Carlo #' error, followed by the number flagged because their estimated log Bayes #' factors lie within two standard errors of an evidence threshold (the #' `fragile` column). @@ -530,8 +530,8 @@ print.bgms_verdicts = function(x, digits = 3, max_rows = 10L, ...) { n_fragile = sum(fragile) if(n_robust + n_fragile > 0) { first = sprintf( - "%d %s not flagged as sensitive to Monte Carlo error.", - n_robust, if(n_robust == 1L) "verdict is" else "verdicts are" + "%d %s robust to Monte Carlo error.", + n_robust, if(n_robust == 1L) "verdict appears" else "verdicts appear" ) second = if(n_fragile == 0L) { "None of the estimated log Bayes factors is flagged as being within two standard errors of an evidence threshold." diff --git a/man/print.bgms_verdicts.Rd b/man/print.bgms_verdicts.Rd index 66ec333b..f10977e0 100644 --- a/man/print.bgms_verdicts.Rd +++ b/man/print.bgms_verdicts.Rd @@ -20,7 +20,7 @@ } \description{ Prints the verdict tally, the leading rows of the verdict table, and a -line giving the number of verdicts not flagged as sensitive to Monte Carlo +line giving the number of verdicts that appear robust to Monte Carlo error, followed by the number flagged because their estimated log Bayes factors lie within two standard errors of an evidence threshold (the \code{fragile} column). diff --git a/tests/testthat/_snaps/verdicts.md b/tests/testthat/_snaps/verdicts.md index da267e1e..63599099 100644 --- a/tests/testthat/_snaps/verdicts.md +++ b/tests/testthat/_snaps/verdicts.md @@ -14,10 +14,9 @@ A-C (pairwise) 0.10 -2.20 undecided TRUE B-C (pairwise) 0.52 0.08 undecided FALSE - 2 verdicts are not flagged as sensitive to Monte Carlo error. 1 verdict could - change on a rerun: its estimated log Bayes factor lies within two standard - errors of an evidence threshold. A longer run may help resolve this - uncertainty. + 2 verdicts appear robust to Monte Carlo error. 1 verdict could change on a + rerun: its estimated log Bayes factor lies within two standard errors of an + evidence threshold. A longer run may help resolve this uncertainty. The fragility flag is not validated for difference indicators: its operating point was established on single-network edge indicators only. @@ -47,10 +46,9 @@ B-C (pairwise) 0.52 0.08 undecided FALSE C (main) 0.50 0.00 undecided FALSE - 5 verdicts are not flagged as sensitive to Monte Carlo error. 1 verdict could - change on a rerun: its estimated log Bayes factor lies within two standard - errors of an evidence threshold. A longer run may help resolve this - uncertainty. + 5 verdicts appear robust to Monte Carlo error. 1 verdict could change on a + rerun: its estimated log Bayes factor lies within two standard errors of an + evidence threshold. A longer run may help resolve this uncertainty. The fragility flag is not validated for difference indicators: its operating point was established on single-network edge indicators only. diff --git a/tests/testthat/test-verdicts.R b/tests/testthat/test-verdicts.R index 2163de91..0fca88a7 100644 --- a/tests/testthat/test-verdicts.R +++ b/tests/testthat/test-verdicts.R @@ -239,7 +239,7 @@ test_that("print.bgms_verdicts tallies verdicts and warns once when fragile", { # Edge indicators are what the flag was calibrated on, so no caveat here. expect_false(grepl("not validated", out)) # The unflagged count comes first; the near-threshold count follows it. - expect_match(out, "not flagged as sensitive to Monte Carlo error") + expect_match(out, "appear robust to Monte Carlo error") if(any(v$fragile)) { expect_match(out, sprintf("%d verdicts? could change on a rerun", sum(v$fragile))) expect_match(out, "A longer run may help resolve this uncertainty") @@ -249,7 +249,7 @@ test_that("print.bgms_verdicts tallies verdicts and warns once when fragile", { v_none = v v_none$fragile = rep(FALSE, nrow(v)) quiet = gsub("\\s+", " ", paste(utils::capture.output(print(v_none)), collapse = " ")) - expect_match(quiet, sprintf("%d verdicts are not flagged", sum(!is.na(v$verdict)))) + expect_match(quiet, sprintf("%d verdicts appear robust", sum(!is.na(v$verdict)))) expect_match(quiet, "None of the estimated log Bayes factors is flagged as being within two standard errors of an evidence threshold") expect_false(grepl("longer run", quiet))