Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
mattansb committed Jul 20, 2023
1 parent 04acb0a commit d639646
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

* The `print()` method for `performance::check_model()` now also evaluates the
default plot type for posterior predictive checks.
* QQ/PP-plots now default to drawing simultaneous testing bands (when the
`qqplotr` package is available). Previous behavior can be restored by setting
`method = "pointwise"`.

# see 0.8.0

Expand Down
17 changes: 13 additions & 4 deletions R/plot.check_normality.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
#' @param colors Character vector of length two, indicating the colors (in
#' hex-format) for points and line.
#' @param detrend Logical that decides if the plot should be detrended.
#' @param method The method used for estimating the qq/pp bands. Default to
#' `"ell"` (equal local levels / simultaneous testing - recommended). See
#' `qqplotr::stat_qq_band()` for more options and details.
#' @inheritParams data_plot
#' @inheritParams plot.see_bayesfactor_parameters
#'
Expand All @@ -31,6 +34,7 @@ plot.see_check_normality <- function(x,
dot_alpha = 0.8,
colors = c("#3aaf85", "#1b6ca8"),
detrend = FALSE,
method = "ell",
...) {
type <- match.arg(type)

Expand Down Expand Up @@ -75,7 +79,8 @@ plot.see_check_normality <- function(x,
alpha_level = alpha,
detrend = detrend,
dot_alpha_level = dot_alpha,
model_info = model_info
model_info = model_info,
method = method
)
} else if (type == "density") {
r <- suppressMessages(stats::residuals(model))
Expand All @@ -95,7 +100,8 @@ plot.see_check_normality <- function(x,
size_line = size_line,
alpha_level = alpha,
detrend = detrend,
dot_alpha_level = dot_alpha
dot_alpha_level = dot_alpha,
method = method
)
}
}
Expand Down Expand Up @@ -145,6 +151,7 @@ plot.see_check_normality <- function(x,
size_line,
alpha_level = 0.2,
detrend = FALSE,
method = "ell",
theme_style = theme_lucid,
colors = unname(social_colors(c("green", "blue", "red"))),
dot_alpha_level = 0.8,
Expand Down Expand Up @@ -175,7 +182,8 @@ plot.see_check_normality <- function(x,
qq_stuff <- list(
qqplotr::stat_qq_band(
alpha = alpha_level,
detrend = detrend
detrend = detrend,
bandType = method
),
qqplotr::stat_qq_point(
shape = 16,
Expand Down Expand Up @@ -246,12 +254,13 @@ plot.see_check_normality <- function(x,
size_line,
alpha_level = 0.2,
detrend = FALSE,
method = "ell",
theme_style = theme_lucid,
colors = unname(social_colors(c("green", "blue", "red"))),
dot_alpha_level = 0.8) {
if (requireNamespace("qqplotr", quietly = TRUE)) {
p_plot <- ggplot2::ggplot(x, ggplot2::aes(sample = .data$res)) +
qqplotr::stat_pp_band(alpha = alpha_level, detrend = detrend) +
qqplotr::stat_pp_band(alpha = alpha_level, detrend = detrend, bandType = method) +
qqplotr::stat_pp_line(
linewidth = size_line,
colour = colors[1],
Expand Down
5 changes: 5 additions & 0 deletions man/plot.see_check_normality.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d639646

Please sign in to comment.