Skip to content

Commit 6ffa8b6

Browse files
committed
add method for check_normality
1 parent a51e77a commit 6ffa8b6

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ S3method(check_normality,htest)
7070
S3method(check_normality,lmerModLmerTest)
7171
S3method(check_normality,merMod)
7272
S3method(check_normality,numeric)
73+
S3method(check_normality,performance_simres)
7374
S3method(check_outliers,BFBayesFactor)
7475
S3method(check_outliers,character)
7576
S3method(check_outliers,data.frame)

R/check_normality.R

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,24 @@ check_normality.glm <- function(x, ...) {
9292
invisible(out)
9393
}
9494

95+
# DHARMa -------------------
96+
97+
#' @export
98+
check_normality.performance_simres <- function(x, ...) {
99+
# check for normality of residuals
100+
res <- stats::residuals(x, quantileFunction = stats::qnorm)
101+
p.val <- suppressWarnings(stats::ks.test(stats::residuals(x), "punif"))$p.value
102+
103+
attr(p.val, "data") <- res
104+
attr(p.val, "object_name") <- insight::safe_deparse_symbol(substitute(x))
105+
attr(p.val, "effects") <- "fixed"
106+
attr(p.val, "type") <- "residuals"
107+
class(p.val) <- unique(c("check_normality", "see_check_normality", class(p.val)))
108+
109+
p.val
110+
}
111+
112+
95113
# numeric -------------------
96114

97115
#' @export

0 commit comments

Comments
 (0)