Skip to content

Commit ff25a41

Browse files
authored
Merge branch 'master' into master
2 parents 6379605 + 906cd5c commit ff25a41

16 files changed

Lines changed: 41 additions & 33 deletions

.github/workflows/test-coverage.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
1919

2020
steps:
21-
- uses: actions/checkout@v4
21+
- uses: actions/checkout@v6
2222

2323
- uses: r-lib/actions/setup-r@v2
2424
with:

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Description: Plotting functions for posterior analysis, MCMC diagnostics,
2626
License: GPL (>= 3)
2727
URL: https://mc-stan.org/bayesplot/
2828
BugReports: https://github.com/stan-dev/bayesplot/issues/
29-
SystemRequirements: pandoc (>= 1.12.3), pandoc-citeproc
29+
SystemRequirements: pandoc (>= 1.12.3)
3030
Depends:
3131
R (>= 4.1.0)
3232
Imports:

NEWS.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# bayesplot (development version)
22

3-
43
* New `show_marginal` argument to `ppd_*()` functions to show the PPD - the marginal predictive distribution by @mattansb (#425)
4+
* Use `rlang::warn()` and `rlang::inform()` for selected PPC user messages instead of base `warning()` and `message()`.
55
* Standardize input validation errors in `ppc_km_overlay()` and interpolation helpers to use `rlang::abort()` for consistent error handling.
66
* Fix assignment-in-call bug in `mcmc_rank_ecdf()` (#).
77
* Replaced deprecated `dplyr` and `tidyselect` functions (`top_n`, `one_of`, `group_indices`) with their modern equivalents to ensure future compatibility. (#431)
@@ -11,6 +11,7 @@
1111
* Fixed test in `test-ppc-distributions.R` that incorrectly used `ppc_dens()` instead of `ppd_dens()` when testing PPD functions
1212
* New functions `mcmc_dots` and `mcmc_dots_by_chain` for dot plots of MCMC draws by @behramulukir (#402)
1313
* Default to `quantiles=100` for all dot plots by @behramulukir (#402)
14+
* Use `"neff_ratio"` consistently in diagnostic color scale helpers to avoid relying on partial matching of `"neff"`.
1415

1516
# bayesplot 1.15.0
1617

R/bayesplot-colors.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ color_scheme_view <- function(scheme = NULL) {
189189

190190
#' @export
191191
print.bayesplot_scheme <- function(x, ...) {
192-
tab <- data.frame(unlist(x, use.names = FALSE), stringsAsFactors = FALSE)
192+
tab <- data.frame(unlist(x, use.names = FALSE))
193193
colnames(tab) <- attr(x, "scheme_name") %||% "hex_color"
194194
print(tab, ...)
195195
}

R/mcmc-diagnostics.R

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,8 @@ mcmc_neff <- function(ratio, ..., size = NULL) {
255255
linetype = 2,
256256
linewidth = 0.25) +
257257
labs(y = NULL, x = expression(N[eff]/N)) +
258-
scale_fill_diagnostic("neff") +
259-
scale_color_diagnostic("neff") +
258+
scale_fill_diagnostic("neff_ratio") +
259+
scale_color_diagnostic("neff_ratio") +
260260
scale_x_continuous(
261261
breaks = breaks,
262262
# as.character truncates trailing zeroes, while ggplot default does not
@@ -287,8 +287,8 @@ mcmc_neff_hist <- function(ratio, ..., binwidth = NULL, bins = NULL, breaks = NU
287287
binwidth = binwidth,
288288
bins = bins,
289289
breaks = breaks) +
290-
scale_color_diagnostic("neff") +
291-
scale_fill_diagnostic("neff") +
290+
scale_color_diagnostic("neff_ratio") +
291+
scale_fill_diagnostic("neff_ratio") +
292292
labs(x = expression(N[eff]/N), y = NULL) +
293293
dont_expand_y_axis(c(0.005, 0)) +
294294
yaxis_title(FALSE) +
@@ -424,12 +424,12 @@ diagnostic_points <- function(size = NULL) {
424424

425425
# Functions wrapping around scale_color_manual() and scale_fill_manual(), used to
426426
# color the intervals by rhat value
427-
scale_color_diagnostic <- function(diagnostic = c("rhat", "neff")) {
427+
scale_color_diagnostic <- function(diagnostic = c("rhat", "neff_ratio")) {
428428
d <- match.arg(diagnostic)
429429
diagnostic_color_scale(d, aesthetic = "color")
430430
}
431431

432-
scale_fill_diagnostic <- function(diagnostic = c("rhat", "neff")) {
432+
scale_fill_diagnostic <- function(diagnostic = c("rhat", "neff_ratio")) {
433433
d <- match.arg(diagnostic)
434434
diagnostic_color_scale(d, aesthetic = "fill")
435435
}

R/mcmc-scatterplots.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,12 @@
9898
#' )
9999
#'
100100
#' # add ellipse
101-
#' p + stat_ellipse(level = 0.9, color = "gray20", size = 1)
101+
#' p + stat_ellipse(level = 0.9, color = "gray20", linewidth = 1)
102102
#'
103103
#' # add contour
104104
#' color_scheme_set("red")
105105
#' p2 <- mcmc_scatter(x, pars = c("alpha", "sigma"), size = 3.5, alpha = 0.25)
106-
#' p2 + stat_density_2d(color = "black", size = .5)
106+
#' p2 + stat_density_2d(color = "black", linewidth = .5)
107107
#'
108108
#' # can also add lines/smooths
109109
#' color_scheme_set("pink")

R/mcmc-traces.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,7 @@ mcmc_trace_data <- function(x,
719719
color = guide_legend(order = 1),
720720
linetype = guide_legend(
721721
order = 2, title = NULL, keywidth = rel(1/2),
722-
override.aes = list(size = rel(1/2)))
722+
override.aes = list(linewidth = rel(1/2)))
723723
)
724724
}
725725
}

R/ppc-censoring.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,10 @@ ppc_km_overlay <- function(
126126
abort("`extrapolation_factor` must be greater than or equal to 1.")
127127
}
128128
if (extrapolation_factor == 1.2) {
129-
message(
129+
inform(paste0(
130130
"Note: `extrapolation_factor` now defaults to 1.2 (20%).\n",
131131
"To display all posterior predictive draws, set `extrapolation_factor = Inf`."
132-
)
132+
))
133133
}
134134

135135
data <- ppc_data(y, yrep, group = status_y)

R/ppc-loo.R

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -202,15 +202,14 @@ ppc_loo_pit_overlay <- function(y,
202202
)
203203

204204
if (!missing(y) && all(y %in% 0:1)) {
205-
warning(
205+
warn(paste0(
206206
"This plot is not recommended for binary data. ",
207207
"For plots that are more suitable see ",
208-
"\nhttps://avehtari.github.io/modelselection/diabetes.html#44_calibration_of_predictions",
209-
call. = FALSE
210-
)
208+
"\nhttps://avehtari.github.io/modelselection/diabetes.html#44_calibration_of_predictions"
209+
))
211210
}
212211

213-
message(paste(
212+
inform(paste(
214213
"NOTE: The kernel density estimate assumes continuous observations",
215214
"and is not optimal for discrete observations."
216215
))
@@ -797,7 +796,7 @@ ppc_loo_ribbon <-
797796
# 1-D Gaussian window filter. This method uses the "reflection method"
798797
# to estimate these pvalues and helps speed up the code
799798
if (any(is.infinite(x))) {
800-
warning(paste(
799+
warn(paste(
801800
"Ignored", sum(is.infinite(x)),
802801
"Non-finite PIT values are invalid for KDE boundary correction method"
803802
))

R/ppc-test-statistics.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -449,9 +449,9 @@ Tyrep_label <- function() expression(italic(T)(italic(y)[rep]))
449449

450450
message_if_using_mean <- function(stat) {
451451
if (is.character(stat) && stat == "mean") {
452-
message(
452+
inform(paste0(
453453
"Note: in most cases the default test statistic 'mean' is ",
454454
"too weak to detect anything of interest."
455-
)
455+
))
456456
}
457457
}

0 commit comments

Comments
 (0)