From 5040b9b0b3ede45905b7397676f13e5aa020d237 Mon Sep 17 00:00:00 2001 From: "Brenton M. Wiernik" Date: Sun, 23 Jul 2023 15:02:27 -0400 Subject: [PATCH] Update check_model() defaults to align with https://github.com/easystats/see/pull/299 Also change default to `verbose = FALSE` --- DESCRIPTION | 1 + R/check_model.R | 9 +++++---- R/check_normality.R | 2 +- man/check_model.Rd | 9 +++++---- man/check_normality.Rd | 2 +- 5 files changed, 13 insertions(+), 10 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 50e2387ac..474728a98 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -124,6 +124,7 @@ Suggests: patchwork, pscl, psych, + qqplotr (>= 0.0.6), randomForest, rmarkdown, rstanarm, diff --git a/R/check_model.R b/R/check_model.R index 0822bcadc..1ea9bd909 100644 --- a/R/check_model.R +++ b/R/check_model.R @@ -27,13 +27,14 @@ #' for dots, and third color for outliers or extreme values. #' @param theme String, indicating the name of the plot-theme. Must be in the #' format `"package::theme_name"` (e.g. `"ggplot2::theme_minimal"`). -#' @param detrend Should QQ/PP plots be detrended? +#' @param detrend Logical. Should Q-Q/P-P plots be de-trended? +#' Defaults to `TRUE` if the *qqplotr* package is installed and `FALSE` otherwise. #' @param show_dots Logical, if `TRUE`, will show data points in the plot. Set #' to `FALSE` for models with many observations, if generating the plot is too #' time-consuming. By default, `show_dots = NULL`. In this case `check_model()` #' tries to guess whether performance will be poor due to a very large model #' and thus automatically shows or hides dots. -#' @param verbose Toggle off warnings. +#' @param verbose If `FALSE` (default), suppress most warning messages. #' @param ... Currently not used. #' @inheritParams check_predictions #' @@ -174,11 +175,11 @@ check_model.default <- function(x, dot_alpha = 0.8, colors = c("#3aaf85", "#1b6ca8", "#cd201f"), theme = "see::theme_lucid", - detrend = FALSE, + detrend = requireNamespace("qqplotr", quietly = TRUE), show_dots = NULL, bandwidth = "nrd", type = "density", - verbose = TRUE, + verbose = FALSE, ...) { # check model formula if (verbose) { diff --git a/R/check_normality.R b/R/check_normality.R index 0f26a557d..b5b658b5e 100644 --- a/R/check_normality.R +++ b/R/check_normality.R @@ -24,7 +24,7 @@ #' (e.g. Q-Q plots) are preferable. For generalized linear models, no formal #' statistical test is carried out. Rather, there's only a `plot()` method for #' GLMs. This plot shows a half-normal Q-Q plot of the absolute value of the -#' standardized deviance residuals is shown (being in line with changes in +#' standardized deviance residuals is shown (in line with changes in #' `plot.lm()` for R 4.3+). #' #' @examples diff --git a/man/check_model.Rd b/man/check_model.Rd index 325e9ec07..18a1d6075 100644 --- a/man/check_model.Rd +++ b/man/check_model.Rd @@ -17,11 +17,11 @@ check_model(x, ...) dot_alpha = 0.8, colors = c("#3aaf85", "#1b6ca8", "#cd201f"), theme = "see::theme_lucid", - detrend = FALSE, + detrend = requireNamespace("qqplotr", quietly = TRUE), show_dots = NULL, bandwidth = "nrd", type = "density", - verbose = TRUE, + verbose = FALSE, ... ) } @@ -55,7 +55,8 @@ for dots, and third color for outliers or extreme values.} \item{theme}{String, indicating the name of the plot-theme. Must be in the format \code{"package::theme_name"} (e.g. \code{"ggplot2::theme_minimal"}).} -\item{detrend}{Should QQ/PP plots be detrended?} +\item{detrend}{Logical. Should Q-Q/P-P plots be de-trended? +Defaults to \code{TRUE} if the \emph{qqplotr} package is installed and \code{FALSE} otherwise.} \item{show_dots}{Logical, if \code{TRUE}, will show data points in the plot. Set to \code{FALSE} for models with many observations, if generating the plot is too @@ -74,7 +75,7 @@ to a different value.} options are appropriate for models with discrete - binary, integer or ordinal etc. - outcomes).} -\item{verbose}{Toggle off warnings.} +\item{verbose}{If \code{FALSE} (default), suppress most warning messages.} } \value{ The data frame that is used for plotting. diff --git a/man/check_normality.Rd b/man/check_normality.Rd index 69f3b273d..b6591cc1d 100644 --- a/man/check_normality.Rd +++ b/man/check_normality.Rd @@ -33,7 +33,7 @@ significant results for the distribution of residuals and visual inspection (e.g. Q-Q plots) are preferable. For generalized linear models, no formal statistical test is carried out. Rather, there's only a \code{plot()} method for GLMs. This plot shows a half-normal Q-Q plot of the absolute value of the -standardized deviance residuals is shown (being in line with changes in +standardized deviance residuals is shown (in line with changes in \code{plot.lm()} for R 4.3+). } \note{