Repository navigation
Carry ACS margins of error through cleaning, with reliability labels - #178
Conversation
Census code -222222222 means the margin could not be computed because there were too few sample cases. The tract cleaner mapped it to 0, which gave the least reliable estimates the tightest intervals. Only -555555555 (a controlled estimate) has a zero margin.
Sums of many zero estimates overstated the margin: a zero estimate's margin is modeled, and Census guidance counts only the largest of them in a sum. Uninsured shares sum 15 C27016 cells, most of them zero, and the widest tract margin was 215.8 points. Separately, a 100% share made the proportion formula's term zero and claimed no sampling error at all; the ratio form now covers that case, as it already did a negative term.
The cleaned tidy, data profile, series and tract tables now keep the margins collected in the RAW tables, and each margin gets a high, medium or low reliability label from its coefficient of variation (data_cleaning/margins.py). The Data Chat catalog lists the new columns and explains how to read them. warehouse.schema.json is regenerated from a scratch build of every ACS table (2009-2024).
iansargent
left a comment
There was a problem hiding this comment.
Overall, looks great. I enjoyed reading up on the coefficient of variation (CV). And this is also very exciting because it will allow for more statistical inference when comparing two locations (p-values, z-statistics, t-statistics, etc.)!
Left one comment idea, so lmk if it should be included in another PR.
Thanks Duane!
Add SQL helpers for the margin of a sum of estimates (root sum of squares) and of a ratio, and use them for the age dependency ratio, the one derived series the cleaning step computes.
iansargent
left a comment
There was a problem hiding this comment.
acs5Housing_incomeBurden_timeseries (housing_cost_burden) is the only one that needs MOE aggregation. It needs sum_moe_sql for Value and the “All households” Total, and the proportion formula for Percent.
acs5Economics_healthInsurance_timeseries (health_insurance) only needs its published margins passed through.
acs5Economics_medianEarnings_timeseries (median_earnings) also only needs its published margins passed through.
Only commenting this because I have the hunch I'm communicating with Duane's agent lol
…series The DP03 series pass their published margins through. Housing cost burden sums bracket and tenure margins by root sum of squares (an aggregate form of sum_moe_sql) and gives Percent the proportion form.
iansargent
left a comment
There was a problem hiding this comment.
LGTM! Some changes might have to be made in the next PR since the aggregated MOEs were slightly addressed on the frontend.
Second of three PRs for Census margins of error, stacked on #177 (collection). Merge #177 first and delete its branch, so this PR retargets to main. The cleaned ACS tables now carry the margins collected there. Each margin gets a reliability label (high, medium or low) from its coefficient of variation. The cut points are a CV under 15% for high and over 30% for low, which is a common convention; the Census sets no official threshold. The label gives the frontend one field for flagging shaky small-town estimates.
value_moe,value_reliability,percent_moeandpercent_reliability. A share whose margin rounds to 0.0 points takes its count's label, so tiny shares aren't marked high.moeandreliability.<measure>_moeand<measure>_reliability.warehouse.schema.jsonis regenerated from a scratch build of the ACS tables.just run-etl 2009 2024once after merging to backfill margins.