From 4127d9dcfe5385e6de1dcfe78204b419414b02e3 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 18 Mar 2024 11:31:58 +0100 Subject: [PATCH] lintrs, spelling --- R/check_overdispersion.R | 6 +++--- R/check_predictions.R | 2 +- R/check_residuals.R | 2 +- R/simulate_residuals.R | 12 ++++++------ man/check_residuals.Rd | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/R/check_overdispersion.R b/R/check_overdispersion.R index db4873c18..0a9cfb595 100644 --- a/R/check_overdispersion.R +++ b/R/check_overdispersion.R @@ -303,10 +303,10 @@ check_overdispersion.performance_simres <- function(x, alternative = c("two.side # check for special arguments - we may pass "object_name" from other methods dots <- list(...) - if (!is.null(dots$object_name)) { - obj_name <- dots$object_name - } else { + if (is.null(dots$object_name)) { obj_name <- insight::safe_deparse_symbol(substitute(x)) + } else { + obj_name <- dots$object_name } # statistics function diff --git a/R/check_predictions.R b/R/check_predictions.R index a1df0c28f..69222d7f8 100644 --- a/R/check_predictions.R +++ b/R/check_predictions.R @@ -106,7 +106,7 @@ check_predictions.default <- function(object, minfo <- insight::model_info(object, verbose = FALSE) # try to find sensible default for "type" argument - suggest_dots <- (minfo$is_bernoulli || minfo$is_count || minfo$is_ordinal || minfo$is_categorical || minfo$is_multinomial) + suggest_dots <- (minfo$is_bernoulli || minfo$is_count || minfo$is_ordinal || minfo$is_categorical || minfo$is_multinomial) # nolint if (missing(type) && suggest_dots) { type <- "discrete_interval" } diff --git a/R/check_residuals.R b/R/check_residuals.R index 7d7d3df3d..2bb284c88 100644 --- a/R/check_residuals.R +++ b/R/check_residuals.R @@ -13,7 +13,7 @@ #' #' @details Uniformity of residuals is checked using a Kolmogorov-Smirnov test. #' There is a `plot()` method to visualize the distribution of the residuals. -#' The test fpr uniformity basically tests to which extent the observed values +#' The test for uniformity basically tests to which extent the observed values #' deviate from the model expectations (i.e. simulated values). In this sense, #' the `check_residuals()` function has similar goals like [`check_predictions()`]. #' diff --git a/R/simulate_residuals.R b/R/simulate_residuals.R index 3dbba0b5b..207b660db 100644 --- a/R/simulate_residuals.R +++ b/R/simulate_residuals.R @@ -97,15 +97,15 @@ plot.performance_simres <- function(x, ...) { .simres_statistics <- function(x, statistic_fun, alternative = "two.sided") { # summarize the observed and simulated residuals - if (!is.null(statistic_fun)) { - # either apply a function to observed and simulated residusls, + if (is.null(statistic_fun)) { + # we pass the values to compute the p-value directly (for "check_outliers()") + observed <- x + simulated <- statistic_fun + } else { + # or apply a function to observed and simulated residusls, # to calcualte a summary statistic observed <- statistic_fun(x$observedResponse) simulated <- apply(x$simulatedResponse, 2, statistic_fun) - } else { - # or we pass the values to compute the p-value directly (for "check_outliers()") - observed <- x - simulated <- statistic_fun } # p is simply ratio of simulated zeros to observed zeros p <- switch(alternative, diff --git a/man/check_residuals.Rd b/man/check_residuals.Rd index 5919e1550..dfb56ff83 100644 --- a/man/check_residuals.Rd +++ b/man/check_residuals.Rd @@ -30,7 +30,7 @@ residual spatial and temporal autocorrelation. \details{ Uniformity of residuals is checked using a Kolmogorov-Smirnov test. There is a \code{plot()} method to visualize the distribution of the residuals. -The test fpr uniformity basically tests to which extent the observed values +The test for uniformity basically tests to which extent the observed values deviate from the model expectations (i.e. simulated values). In this sense, the \code{check_residuals()} function has similar goals like \code{\link[=check_predictions]{check_predictions()}}. }