From 2856fe4982a26f60cfe8a9ab0073feb0b37bee2d Mon Sep 17 00:00:00 2001 From: Aki Vehtari Date: Wed, 25 Oct 2023 19:54:49 +0300 Subject: [PATCH 1/2] better loo_pit_qq plots --- R/ppc-loo.R | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/R/ppc-loo.R b/R/ppc-loo.R index 77905962..bbdf64d9 100644 --- a/R/ppc-loo.R +++ b/R/ppc-loo.R @@ -189,7 +189,7 @@ ppc_loo_pit_overlay <- function(y, geom_line( aes(color = "y"), data = function(x) dplyr::filter(x, .data$is_y), - linewidth = 1, + linewidth = 1, lineend = "round", na.rm = TRUE) + scale_x_continuous( @@ -326,21 +326,23 @@ ppc_loo_pit_qq <- function(y, y_lab <- "LOO-PIT (standard normal quantiles)" } - ggplot(data.frame(p = pit)) + + qq <- ggplot(data.frame(p = pit)) + geom_qq( aes(sample = .data$p), distribution = theoretical, color = get_color("m"), size = size, alpha = alpha) + - geom_qq_line( - aes(sample = .data$p), + geom_abline( linetype = 2, - distribution = theoretical, - color = "black", - fullrange = FALSE) + + color = "black") + bayesplot_theme_get() + labs(x = x_lab, y = y_lab) + if (compare == "uniform") { + qq + lims(x=c(0,1), y=c(0,1)) + } else { + qq + } } From 6cb9ce742d600beabe0eadfdc817b1e04e0de085 Mon Sep 17 00:00:00 2001 From: jgabry Date: Wed, 17 Jan 2024 13:03:44 -0700 Subject: [PATCH 2/2] Update ppc-loo-pit-qq-default.svg --- .../_snaps/ppc-loo/ppc-loo-pit-qq-default.svg | 246 +++++++++--------- 1 file changed, 120 insertions(+), 126 deletions(-) diff --git a/tests/testthat/_snaps/ppc-loo/ppc-loo-pit-qq-default.svg b/tests/testthat/_snaps/ppc-loo/ppc-loo-pit-qq-default.svg index 47fb8158..5093dd94 100644 --- a/tests/testthat/_snaps/ppc-loo/ppc-loo-pit-qq-default.svg +++ b/tests/testthat/_snaps/ppc-loo/ppc-loo-pit-qq-default.svg @@ -20,136 +20,130 @@ - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - -0.0 -0.5 -1.0 -1.5 - - - - - - - - - - -0.00 -0.25 -0.50 -0.75 -1.00 -Uniform + +0.00 +0.25 +0.50 +0.75 +1.00 + + + + + + + + + + + +0.00 +0.25 +0.50 +0.75 +1.00 +Uniform LOO-PIT -ppc_loo_pit_qq (default) +ppc_loo_pit_qq (default)