From 9e1ca4d88136c36123036d7d49ff3e59650e730c Mon Sep 17 00:00:00 2001 From: Daniel Date: Wed, 25 Oct 2023 12:36:58 +0200 Subject: [PATCH] add comments --- R/binned_residuals.R | 2 ++ 1 file changed, 2 insertions(+) diff --git a/R/binned_residuals.R b/R/binned_residuals.R index d7461c8c7..d8444ee7d 100644 --- a/R/binned_residuals.R +++ b/R/binned_residuals.R @@ -103,6 +103,7 @@ binned_residuals <- function(model, show_dots <- is.null(n) || n <= 1e5 } + # make sure response is 0/1 (and numeric) y0 <- .recode_to_zero(insight::get_response(model, verbose = FALSE)) # calculate residuals @@ -136,6 +137,7 @@ binned_residuals <- function(model, gaussian = stats::qnorm(c((1 - ci) / 2, (1 + ci) / 2), mean = ybar, sd = sdev / sqrt(n)), exact = { out <- stats::binom.test(sum(y0[items]), n)$conf.int + # center CIs around point estimate out <- out - (min(out) - ybar) - (diff(out) / 2) out },