Skip to content

Commit 3a76b7d

Browse files
committed
xlim -> [0,1] if using boundary correction
1 parent 6a60492 commit 3a76b7d

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

R/ppc-loo.R

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@
8383
#' # marginal predictive check using LOO probability integral transform
8484
#' color_scheme_set("orange")
8585
#' ppc_loo_pit_overlay(y, yrep, lw = lw)
86-
#' ppc_loo_pit_overlay(y, yrep, lw = lw, boundary_correction = TRUE)
8786
#'
8887
#' ppc_loo_pit_qq(y, yrep, lw = lw)
8988
#' ppc_loo_pit_qq(y, yrep, lw = lw, compare = "normal")
@@ -188,7 +187,11 @@ ppc_loo_pit_overlay <- function(y,
188187
data = function(x) dplyr::filter(x, .data$is_y),
189188
size = 1,
190189
lineend = "round",
191-
na.rm = TRUE)
190+
na.rm = TRUE) +
191+
scale_x_continuous(
192+
limits = c(0, 1),
193+
expand = expansion(0, 0)
194+
)
192195

193196
} else {
194197
p <- ggplot(data) +
@@ -218,18 +221,20 @@ ppc_loo_pit_overlay <- function(y,
218221
adjust = adjust,
219222
kernel = kernel,
220223
n = n_dens,
221-
na.rm = TRUE)
224+
na.rm = TRUE) +
225+
scale_x_continuous(
226+
limits = c(0.05, 0.95),
227+
expand = expansion(0, 0),
228+
breaks = seq(from = .1, to = .9, by = .2)
229+
)
222230
}
223231

224232
p +
225233
scale_color_ppc_dist(labels = c("PIT", "Unif")) +
226-
scale_x_continuous(
227-
limits = c(0.05, 0.95),
228-
expand = expansion(0, 0),
229-
breaks = seq(from = .1, to = .9, by = .2)) +
230234
scale_y_continuous(
231235
limits = c(0, NA),
232-
expand = expansion(mult = c(0, .25))) +
236+
expand = expansion(mult = c(0, .25))
237+
) +
233238
bayesplot_theme_get() +
234239
yaxis_title(FALSE) +
235240
xaxis_title(FALSE) +

0 commit comments

Comments
 (0)