Skip to contents

Applies the six exclusion layers from the 2024 paper's outlier treatment to a SUBE comparison table or results summary. These are historical, paper-specific filters - not general-purpose data-quality rules.

Usage

filter_paper_outliers(
  data,
  variables = c("GO", "VA", "EMP", "CO2"),
  apply_bounds = TRUE
)

Arguments

data

A tidy comparison table (the shape returned by prepare_sube_comparison) or a SUBE results summary with COUNTRY, YEAR, CPAagg, variable, measure, value columns.

variables

Character vector subset of c("GO", "VA", "EMP", "CO2") indicating which metrics to retain. Rows whose variable is not in this set are dropped before the layered filters apply. Defaults to all four.

apply_bounds

Logical; whether to apply layer 5 (multiplier plausibility bounds). Defaults to TRUE. Set FALSE to keep multiplier outliers in the output.

Value

A filtered data.table with the same columns as data.

Details

The six layers:

  1. Drop whole countries: CAN, CYP.

  2. Drop country-year range: BEL 2000-2008; drop CO2 rows with YEAR > 2009.

  3. Drop 38 country-product pairs across 14 countries (e.g. LUX P04/P05/P06/...).

  4. Drop CO2 rows for CHE, HRV, NOR.

  5. Multiplier plausibility bounds (only when apply_bounds = TRUE): GO in [1, 4], VA in [0, 1], EMP/CO2 >= 0.

  6. Drop rows where elasticity is negative.

Examples

if (FALSE) { # \dontrun{
  comp <- prepare_sube_comparison(leontief, models)
  filt <- filter_paper_outliers(comp)
  filt_no_bounds <- filter_paper_outliers(comp, apply_bounds = FALSE)
} # }