From d6f69c9ab9d7b3680c1369eb3f4847153c8030ff Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 1 Mar 2022 08:20:31 +0100 Subject: [PATCH] #382 --- R/binned_residuals.R | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/R/binned_residuals.R b/R/binned_residuals.R index edd189384..ec2f72986 100644 --- a/R/binned_residuals.R +++ b/R/binned_residuals.R @@ -87,7 +87,8 @@ binned_residuals <- function(model, term = NULL, n_bins = NULL, ...) { n = n, x.lo = model.range[1], x.hi = model.range[2], - se = 2 * sdev / sqrt(n) + se = stats::qnorm(.975) * sdev / sqrt(n), + ci_range = sdev / sqrt(n) ) })) @@ -95,8 +96,8 @@ binned_residuals <- function(model, term = NULL, n_bins = NULL, ...) { d <- d[stats::complete.cases(d), ] # CIs - d$CI_low <- d$ybar - stats::qnorm(.975) * d$se - d$CI_high <- d$ybar + stats::qnorm(.975) * d$se + d$CI_low <- d$ybar - stats::qnorm(.975) * d$ci_range + d$CI_high <- d$ybar + stats::qnorm(.975) * d$ci_range gr <- abs(d$ybar) > abs(d$se) d$group <- "yes"