assign_funnel_significance {PHEindicatormethods} | R Documentation |
Identifies whether each value in a dataset falls outside of 95 and/or 99.8 percent control limits based on the aggregated average value across the whole dataset as an indicator of statistically significant difference.
Description
This follows the funnel plot methodology published on the PHE Fingertips Technical Guidance page: https://fingertips.phe.org.uk/profile/guidance/supporting-information/PH-methods
Usage
assign_funnel_significance(
data,
numerator,
denominator,
rate,
statistic = NULL,
rate_type = NULL,
multiplier = NULL
)
Arguments
data |
a data.frame containing the data to assign significance 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 |
statistic |
type of statistic to inform funnel calculations. Acceptable values are "proportion", "ratio" or "rate"; string; no default |
rate_type |
if statistic is "rate", specify either "dsr" or "crude"; string; no default |
multiplier |
the multiplier that the rate is normalised with (ie, per 100,000); only required when statistic = "rate"; numeric; no default |
Value
returns the original data.frame with the significance level appended
Author(s)
Matthew Francis
See Also
Other PHEindicatormethods package functions:
calculate_ISRate()
,
calculate_ISRatio()
,
calculate_funnel_limits()
,
calculate_funnel_points()
,
phe_dsr()
,
phe_life_expectancy()
,
phe_mean()
,
phe_proportion()
,
phe_quantile()
,
phe_rate()
,
phe_sii()
Examples
library(dplyr)
df <- data.frame(
Area = c("A", "B", "C", "D"),
numerator = c(10232, 12321, 15123, 13213),
denominator = c(15232, 16123, 17932, 18475)
)
df %>%
assign_funnel_significance(numerator, denominator,
statistic = "proportion", multiplier = 100)