From 5b439d7c9ec9e6d2c46163b55b953b40cd301f4a Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 30 Oct 2023 08:02:07 +0100 Subject: [PATCH] docs --- R/check_residuals.R | 6 ++++++ R/simulate_residuals.R | 5 ++++- man/check_residuals.Rd | 9 +++++++++ man/simulate_residuals.Rd | 6 +++++- 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/R/check_residuals.R b/R/check_residuals.R index 8ef1f6866..c0968fb28 100644 --- a/R/check_residuals.R +++ b/R/check_residuals.R @@ -11,6 +11,12 @@ #' See [`stats::ks.test()`] for details. #' @param ... Passed down to [`stats::ks.test()`] #' +#' @details Uniformity of residuals is checked using a Kolmogorov-Smirnov test. +#' +#' @seealso [`simulate_residuals()`] +#' +#' @return The p-value of the test statistics. +#' #' @examplesIf require("DHARMa") #' dat <- DHARMa::createData(sampleSize = 100, overdispersion = 0.5, family = poisson()) #' m <- glm(observedResponse ~ Environment1, family = poisson(), data = dat) diff --git a/R/simulate_residuals.R b/R/simulate_residuals.R index 819c90bf9..1afd84851 100644 --- a/R/simulate_residuals.R +++ b/R/simulate_residuals.R @@ -7,7 +7,10 @@ #' @param iterations Number of simulations to run. #' @param ... Arguments passed on to [`DHARMa::simulateResiduals()`]. #' -#' @return Simulated residuals. +#' @return Simulated residuals, which can be further processed with +#' [`check_residuals()`]. +#' +#' @seealso [`check_residuals()`] #' #' @details Based on [`DHARMa::simulateResiduals()`]. See also `vignette("DHARMa")`. #' diff --git a/man/check_residuals.Rd b/man/check_residuals.Rd index fdeb931d9..412615ef3 100644 --- a/man/check_residuals.Rd +++ b/man/check_residuals.Rd @@ -18,12 +18,18 @@ check_residuals(x, ...) \item{alternative}{A character string specifying the alternative hypothesis. See \code{\link[stats:ks.test]{stats::ks.test()}} for details.} } +\value{ +The p-value of the test statistics. +} \description{ \code{check_residuals()} checks generalized linear (mixed) models for uniformity of randomized quantile residuals, which can be used to identify typical model misspecification problems, such as over/underdispersion, zero-inflation, and residual spatial and temporal autocorrelation. } +\details{ +Uniformity of residuals is checked using a Kolmogorov-Smirnov test. +} \examples{ \dontshow{if (require("DHARMa")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} dat <- DHARMa::createData(sampleSize = 100, overdispersion = 0.5, family = poisson()) @@ -32,3 +38,6 @@ res <- simulate_residuals(m) check_residuals(res) \dontshow{\}) # examplesIf} } +\seealso{ +\code{\link[=simulate_residuals]{simulate_residuals()}} +} diff --git a/man/simulate_residuals.Rd b/man/simulate_residuals.Rd index 4e0498624..f032aabd9 100644 --- a/man/simulate_residuals.Rd +++ b/man/simulate_residuals.Rd @@ -14,7 +14,8 @@ simulate_residuals(x, iterations = 250, ...) \item{...}{Arguments passed on to \code{\link[DHARMa:simulateResiduals]{DHARMa::simulateResiduals()}}.} } \value{ -Simulated residuals. +Simulated residuals, which can be further processed with +\code{\link[=check_residuals]{check_residuals()}}. } \description{ to do. @@ -37,3 +38,6 @@ https://CRAN.R-project.org/package=DHARMa of Computational and Graphical Statistics, 5(3), 236. \doi{10.2307/1390802} } } +\seealso{ +\code{\link[=check_residuals]{check_residuals()}} +}