Skip to content

Commit

Permalink
add method for check_normality
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Oct 27, 2023
1 parent a51e77a commit 6ffa8b6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ S3method(check_normality,htest)
S3method(check_normality,lmerModLmerTest)
S3method(check_normality,merMod)
S3method(check_normality,numeric)
S3method(check_normality,performance_simres)
S3method(check_outliers,BFBayesFactor)
S3method(check_outliers,character)
S3method(check_outliers,data.frame)
Expand Down
18 changes: 18 additions & 0 deletions R/check_normality.R
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,24 @@ check_normality.glm <- function(x, ...) {
invisible(out)
}

# DHARMa -------------------

#' @export
check_normality.performance_simres <- function(x, ...) {
# check for normality of residuals
res <- stats::residuals(x, quantileFunction = stats::qnorm)
p.val <- suppressWarnings(stats::ks.test(stats::residuals(x), "punif"))$p.value

attr(p.val, "data") <- res
attr(p.val, "object_name") <- insight::safe_deparse_symbol(substitute(x))
attr(p.val, "effects") <- "fixed"
attr(p.val, "type") <- "residuals"
class(p.val) <- unique(c("check_normality", "see_check_normality", class(p.val)))

p.val
}


# numeric -------------------

#' @export
Expand Down

0 comments on commit 6ffa8b6

Please sign in to comment.