Skip to contents

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.

Usage

calculate_district_outlier_summary(.data)

Arguments

.data

A data frame containing district-level health indicator data. This data frame must include precomputed outlier flags (columns ending in _outlier5std), where 1 represents an outlier and 0 represents non-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.

Examples

if (FALSE) { # \dontrun{
  # Summarize the proportion of districts without extreme outliers
  calculate_district_outlier_summary(data)
} # }