docs: ground the census-vs-sample advice in the published corpus (#72)
Checked against the published corpus (build of 2026-10-26) through the public API: - FY2022 Georgia cities, Police: 567 expected, 535 collected, 393 reporting. The 174-city gap is 32 not collected and 142 collected with no Police rows. The FY2022 section now states the split. - All US cities: Police participation among collected cities is 0.70, 0.73 and 0.72 in FY2012, FY2017 and FY2022, and 0.93 to 0.95 in every sample year FY2013-FY2023. Among the 3,867 cities collected in both FY2022 and FY2021 it is 0.929 and 0.935; Fire, Libraries and Housing & Community move by 0.01 or less on the same cities. A census year and a sample year collect different sets of governments, so the census-vs-sample section now recommends comparing census years with each other, or the same governments across years, and adds a fixture chunk that measures participation over the 99 Georgia cities collected in both FY2012 and FY2019 (0.97 and 0.94). The fixture caveat now says what data-raw/regenerate_fixture_corpus.R does: each fixture year is a full copy of the published partition. Its FY2012 and FY2019 Georgia Police counts match the published corpus; the newer crosswalk lists 567 Georgia cities where the fixture lists 566. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qbe6u2h83wgZdTgJgE4Xh5
This commit is contained in:
1 file changed
+45
-12
@@ -24,9 +24,11 @@ governments has a row still gets a row in the table, with `n_units_reporting` eq
|
|||||||
to zero.
|
to zero.
|
||||||
|
|
||||||
Point `USCOGDATA_URL` at the bundled fixture corpus to run the examples without
|
Point `USCOGDATA_URL` at the bundled fixture corpus to run the examples without
|
||||||
network access or credentials. The fixture carries FY2011, FY2012, FY2019 and FY2020
|
network access or credentials. The fixture copies four full years of the published
|
||||||
for all 50 states. Every count computed from it is fixture output and not a real
|
corpus, FY2011, FY2012, FY2019 and FY2020, from its 2026-08-03 build. Its FY2012 and
|
||||||
Georgia figure.
|
FY2019 counts for Georgia cities and Police match the published corpus as of the
|
||||||
|
2026-10-26 build, except that the newer crosswalk lists 567 Georgia cities where the
|
||||||
|
fixture lists 566.
|
||||||
|
|
||||||
```{r}
|
```{r}
|
||||||
library(uscogdata)
|
library(uscogdata)
|
||||||
@@ -161,9 +163,38 @@ the typical Georgia city, and a larger share of them report Police spending. A
|
|||||||
sample-year participation rate describes the cities Census sampled that year, so use
|
sample-year participation rate describes the cities Census sampled that year, so use
|
||||||
a census year to estimate the share of all Georgia cities with Police spending.
|
a census year to estimate the share of all Georgia cities with Police spending.
|
||||||
|
|
||||||
The collection rate shows which kind of year you are looking at. When it is low, treat
|
To compare a census year with a sample year, hold the governments fixed. Take the
|
||||||
both the amounts and the participation rate as statements about the sampled
|
cities collected in both years and measure participation among them:
|
||||||
governments.
|
|
||||||
|
```{r}
|
||||||
|
both <- intersect(
|
||||||
|
collected$canonical_govid[collected$year == 2012],
|
||||||
|
collected$canonical_govid[collected$year == 2019]
|
||||||
|
)
|
||||||
|
length(both)
|
||||||
|
|
||||||
|
reported <- unique(police[, c("year", "canonical_govid")])
|
||||||
|
sapply(c(FY2012 = 2012, FY2019 = 2019), function(y) {
|
||||||
|
mean(both %in% reported$canonical_govid[reported$year == y])
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
On the fixture, 99 Georgia cities were collected in both FY2012 and FY2019. Among
|
||||||
|
them, participation is 0.97 in FY2012 and 0.94 in FY2019, against 0.75 and 0.93 among
|
||||||
|
all collected cities. Once the cities are the same, the FY2019 rate is no longer
|
||||||
|
higher than the FY2012 rate.
|
||||||
|
|
||||||
|
The published corpus shows the same pattern for every US city. As of its 2026-10-26
|
||||||
|
build, Police participation among collected cities is 0.70, 0.73 and 0.72 in the
|
||||||
|
census years FY2012, FY2017 and FY2022, and between 0.93 and 0.95 in every sample year
|
||||||
|
from FY2013 to FY2023. Among the 3,867 cities collected in both FY2022 and FY2021, it
|
||||||
|
is 0.929 in FY2022 and 0.935 in FY2021. Fire, Libraries and Housing & Community behave
|
||||||
|
the same way: participation among the same cities moves by 0.01 or less between those
|
||||||
|
two years, while participation among all collected cities rises by 0.16 to 0.24.
|
||||||
|
|
||||||
|
Compare participation between two census years, or between the same governments in
|
||||||
|
two years. All collected governments in a census year and all collected governments
|
||||||
|
in a sample year are two different sets of cities.
|
||||||
|
|
||||||
# The FY2022 example on the published corpus
|
# The FY2022 example on the published corpus
|
||||||
|
|
||||||
@@ -182,10 +213,11 @@ police_2022 <- cog_geographic_rollup(
|
|||||||
attr(police_2022, "provenance")$coverage
|
attr(police_2022, "provenance")$coverage
|
||||||
```
|
```
|
||||||
|
|
||||||
Those pages report 393 of 567 Georgia cities with Police rows in FY2022 and attribute
|
On the published corpus, as of its 2026-10-26 build, the chunk returns 567 expected,
|
||||||
most of the 174-city gap to cities that contract policing to the county sheriff. Run
|
535 collected and 393 reporting. The 174 cities without Police rows split into 32
|
||||||
the chunk and read `n_units_collected` to split the 174 into the two groups: the
|
that Census did not collect and 142 that were collected and have no Police rows. The
|
||||||
cities Census did not collect, and the collected cities with no Police rows.
|
reference pages attribute most of the gap to cities that contract policing to the
|
||||||
|
county sheriff, and the counters place 142 of the 174 in the second group.
|
||||||
|
|
||||||
# Peer comparisons count peers only
|
# Peer comparisons count peers only
|
||||||
|
|
||||||
@@ -266,5 +298,6 @@ year, the fixture has spending rows for 534 of its 566 Georgia cities.
|
|||||||
governments.
|
governments.
|
||||||
- `n_units_reporting / n_units_expected` mixes the two, so read the counters
|
- `n_units_reporting / n_units_expected` mixes the two, so read the counters
|
||||||
separately before you explain a gap.
|
separately before you explain a gap.
|
||||||
- A sample year collects a different set of governments from a census year, so
|
- A sample year collects a different set of governments from a census year.
|
||||||
compare participation rates across those years with care.
|
Compare participation between census years, or between the same governments
|
||||||
|
across years.
|
||||||
Reference in new issue
Block a user