Skip to content

Commit

Permalink
add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Oct 25, 2023
1 parent 1df774f commit 9e1ca4d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions R/binned_residuals.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
},
Expand Down

0 comments on commit 9e1ca4d

Please sign in to comment.