Skip to contents

Compares package estimates with published income-poverty benchmarks. This is an analytical comparison layer, not an official validation claim. Real reproducibility requires running the full pipeline on official ENEMDU microdata with documented filters, weights, domains, and poverty-line inputs.

Usage

enemdu_compare_official_poverty(
  estimates,
  benchmarks = enemdu_official_poverty_benchmarks(),
  period = NULL,
  benchmark_set = NULL,
  domain_vars = NULL,
  domain_map = NULL,
  estimate_col = "estimate",
  indicator_col = "indicator_id",
  tolerance_pp = 0.1,
  strict = FALSE
)

Arguments

estimates

A data frame returned by enemdu_kpi_income_poverty() or an equivalent table.

benchmarks

Official benchmark table. Defaults to enemdu_official_poverty_benchmarks().

period

Optional benchmark period filter.

benchmark_set

Optional benchmark set filter.

domain_vars

Optional package estimate domain variables. The first variable is used as the benchmark domain_type.

domain_map

Optional named character vector mapping package domain values to benchmark domain values.

estimate_col

Estimate column in estimates.

indicator_col

Indicator id column in estimates.

tolerance_pp

Tolerance in percentage points.

strict

Logical. If TRUE, errors when a comparison is outside tolerance or missing on either side.

Value

A tibble with comparison status and difference metadata.

Examples

estimates <- tibble::tibble(
  indicator_id = c("pobreza_ingresos", "pobreza_extrema_ingresos"),
  estimate = c(0.214, 0.083)
)

enemdu_compare_official_poverty(
  estimates,
  period = "2025-12",
  benchmark_set = "income_poverty_december_2025"
)
#> # A tibble: 2 × 27
#>   indicator_id         domain_type domain_value period benchmark_set survey_type
#>   <chr>                <chr>       <chr>        <chr>  <chr>         <chr>      
#> 1 pobreza_ingresos     national    national     2025-… income_pover… mensual    
#> 2 pobreza_extrema_ing… national    national     2025-… income_pover… mensual    
#> # ℹ 21 more variables: package_estimate <dbl>, official_estimate <dbl>,
#> #   estimate_percent <dbl>, official_percent <dbl>, difference <dbl>,
#> #   difference_pp <dbl>, abs_difference_pp <dbl>, tolerance_pp <dbl>,
#> #   comparison_status <chr>, comparison_validation_status <chr>,
#> #   comparison_note <chr>, poverty_line_value <dbl>,
#> #   extreme_poverty_line_value <dbl>, currency <chr>, source_institution <chr>,
#> #   source_title <chr>, source_period <chr>, source_page <chr>, …