Calculate District-Level Outliers Summary by Year
Source:R/1a_checks_outlier.R
calculate_district_outlier_summary.Rd
calculate_district_outlier_summary
computes a district-level summary of extreme
outliers for specified health indicators. This function aggregates extreme outlier counts
for each indicator by first identifying the maximum outlier flag within each district
and year. An outlier is flagged based on Hampel's X84 method, where values exceeding
five Median Absolute Deviations (MAD) from the median are considered extreme outliers.
Value
A cd_district_outliers_summary
object (tibble) with:
Each indicator's percentage of districts without extreme outliers, calculated yearly.
Aggregated summaries for non-outliers across all indicators, vaccination indicators, and tracer indicators.
Details
Outlier Aggregation: The function first calculates the maximum outlier flag within each district and year. This district-level flag is used to determine if extreme outliers are present for each indicator.
Non-Outlier Percentage: After aggregating by district and year, it computes the mean percentage of districts without extreme outliers for each indicator, as well as overall summaries for vaccination-only and tracer indicators.
Rounding: Non-outlier percentages are rounded to two decimal places for clarity in reporting and analysis.