Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Mar 1, 2022
1 parent f841500 commit d6f69c9
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions R/binned_residuals.R
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,17 @@ 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)
)
}))

d <- do.call(rbind, d)
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"
Expand Down

0 comments on commit d6f69c9

Please sign in to comment.