Skip to contents

Make a function to calculate funnel plot limits

Usage

make_cl(denom, var, exact = FALSE, scale = 100)

Arguments

denom

Numeric vector of denominator values for the funnel plot.

var

Numeric vector of y values for the funnel plot.

exact

Logical, whether to use exact control limits (default: FALSE).

scale

Numeric, scale factor if rate is percent (default: 100).

Value

A function that takes two arguments: x (denominator values) and p (limit percentile), and returns the y value for the limit. This returned function can be used in ggplot2's geom_function.

Examples

if (FALSE) { # \dontrun{
denom <- 1:100
var <- runif(100)
cl_fun <- make_cl(denom, var)
# Use in ggplot2:
# ggplot(...) +
#   geom_function(fun = cl_fun, args = list(p = 0.975)
} # }