Skip to contents

Used by the annual-update "replication" steps to compare a pipeline output such as acs_by_tract (or the per-block-group EJ-index percentile-rank / threshold layers) against EPA's published EJScreen values. EPA exposes these as ArcGIS FeatureServers (e.g. the EJScreen_Census service's by_Tract layer), not as archived CSVs in the S3 pipeline folders, so the EPA reference is typically fetched live from a feature server rather than read from a stage file.

Usage

ejscreen_compare_geography_to_epa(
  ejam_table,
  reference,
  ejam_fips_col = "tractfips",
  reference_fips_col = "STCNTR",
  reference_cols = NULL,
  pct_scale = 100
)

Arguments

ejam_table

EJAM output (e.g. acs_by_tract) with ejam_fips_col and EJAM rname indicator columns.

reference

EPA reference table (e.g. the attributes from a EJScreen_Census/.../by_Tract feature-server query) with reference_fips_col and EPA ACS-style column names.

ejam_fips_col, reference_fips_col

Id columns. Defaults "tractfips" and "STCNTR" (EPA's full 11-digit tract GEOID field).

reference_cols

EPA columns to compare; default is all non-id columns.

pct_scale

Factor applied to EJAM percentage columns to match EPA's 0-100 scale. Default 100.

Value

A data.frame, one row per compared indicator: reference, rname, n, cor, median_absdiff (sorted worst-agreement first), with attribute "n_joined".

Details

The comparison: (1) repair FIPS leading zeros on both id columns with fips_lead_zero(); (2) map EPA's ACS-style column names (e.g. TOTALPOP, PCT_LOWINC) to EJAM rnames with fixcolnames(); (3) inner-join on the id; (4) for each shared indicator report n, correlation, and median absolute difference. EPA stores percentages as 0-100 while EJAM stores fractions 0-1, so percentage indicators are scaled by pct_scale (default 100) before comparison. This only checks indicators EJAM actually has; EPA's extra "extensive ACS" demographics are ignored. It is meaningful only when the pipeline build and the EPA reference are the same ACS vintage (e.g. both ACS 2018-2022).