calculate_funnel_limits | R Documentation |
Calculates control limits adopting a consistent method as per the PHE Fingertips Technical Guidance: https://fingertips.phe.org.uk/profile/guidance/supporting-information/PH-methods
calculate_funnel_limits(
data,
numerator,
denominator,
rate,
type = "full",
multiplier = NULL,
statistic = NULL,
ratio_type = NULL,
rate_type = NULL,
years_of_data = NULL
)
data |
a data.frame containing the data to calculate control limits for; unquoted string; no default |
numerator |
field name from data containing the observed numbers of cases in the sample meeting the required condition (the numerator or observed counts for the control limits); unquoted string; no default |
denominator |
field name from data containing the population(s) in the sample (the denominator or expected counts for the control limits); unquoted string; no default |
rate |
field name from data containing the rate data when creating funnels for a Crude or Directly Standardised Rate; unquoted string; no default |
type |
defines the data and metadata columns to be included in output; "standard" (for all data) or "full" (for all data and metadata); quoted string; default = "full" |
multiplier |
the multiplier used to express the final values (eg 100 = percentage); numeric; no default |
statistic |
type of statistic to inform funnel calculations. Acceptable values are "proportion", "ratio" or "rate"; string; no default |
ratio_type |
if statistic is "ratio", specify either "count" or "isr" (indirectly standardised ratio); string; no default |
rate_type |
if statistic is "rate", specify either "dsr" or "crude"; string; no default |
years_of_data |
number of years the data represents; this is required for statistic = "rate"; numeric; no default |
returns the original data.frame with the following appended: lower 0.025 limit, upper 0.025 limit, lower 0.001 limit, upper 0.001 limit and baseline average
Matthew Francis
Other PHEindicatormethods package functions:
assign_funnel_significance()
,
calculate_ISRate()
,
calculate_ISRatio()
,
calculate_dsr()
,
calculate_funnel_points()
,
phe_dsr()
,
phe_life_expectancy()
,
phe_mean()
,
phe_proportion()
,
phe_quantile()
,
phe_rate()
,
phe_sii()
library(dplyr)
set.seed(123)
df <- data.frame(obs = sample(200, 19 * 2 * 5 * 4, replace = TRUE),
pop = sample(10000:20000, 19 * 2 * 5 * 4, replace = TRUE))
df %>%
calculate_funnel_limits(obs, pop, statistic = "proportion", multiplier = 100)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.