CDC suppresses small county counts. impute_suppressed() gives each
suppressed county a count so county data can be added up or shared across
census tracts with extrapolate_from_county(). Run it on county data from
get_atlas() before no_county_cases() or extrapolate_from_county().
Rows are handled by what CDC published:
A published count is kept, whatever its data status. (Connecticut's 2017 planning regions are marked "Data not available" but have counts.)
A row marked "Data not available" with no count has no data to estimate from;
not_availablesays whether it is kept or dropped. Its cases are still in the state total, sono_county_cases()counts them in the remainder, as long as the state still has a row in that indicator, year and stratum.A row marked "Data suppressed" with no count is filled in by
method.A row with no count and any other status (or none), such as "No reported cases" or a code this version doesn't know, is not filled in: it stays
NAand is marked"not estimated", with a warning.
Arguments
- x
County data from
get_atlas(geography = "county").- method
How suppressed counts are filled in:
"state_rate"(default): the state's rate in the same indicator, year and stratum, times the county's population (seepopulation), kept betweenfloorandcap."zero": 0. Useful as a sensitivity analysis.
- cap
The largest count
"state_rate"can give a suppressed county. UseInffor no cap. The default, 4, reflects CDC suppressing counts of 1 to 4, but complementary suppression can hide larger counts, so it is a default rather than a hard limit.cases_uncappedin the output lets you count how often the cap sets the value.floor = cap = 2.5gives every row that can be estimated the same fixed value, 2.5.- floor
The smallest count
"state_rate"can give. The default, 0, allows for counties suppressed because their population is under 100, which may have no cases. Use 1 to treat every suppressed county as having at least one case. Must not be larger thancap.- population
The county population
"state_rate"multiplies by:"cdc"(default): CDC's own county population, the same source as the state rate's denominator."acs": the county's ACS 5-year population in the same stratum and ages, summed from its tracts asextrapolate_from_county()does. Needs tidycensus and a Census API key.
"acs"accepts the same input asextrapolate_from_county(): at most one stratification variable, and no congenital syphilis (whose rates are per 100,000 live births). It also refuses Knowledge of Status, whose denominator is people living with HIV, not residents. Other input stops before anything is downloaded; use"cdc"for it.CDC gives Connecticut's 2017 planning regions no population, so
"cdc"can't estimate them;"acs"can, from 2010 tracts assigned to the planning regions (seeextrapolate_from_county()).- unestimated
What to do with a suppressed row
"state_rate"can't estimate, because the state rate or county population is missing:"na"(default): leave itNA, with a warning.no_county_cases()counts its cases in the remainder with no county, andextrapolate_from_county()leaves it out (or stops, withunestimated = "error")."zero": set it to 0, with a warning.
- not_available
Rows marked "Data not available" with no count:
"keep"(default): keep them withNAcases. The later steps leave them out of the tracts, and their cases stay in the state's remainder."drop": remove them, with a message. If that removes every row a state has in an indicator, year and stratum, that state's remainder is no longer reported byno_county_cases()or spread byextrapolate_from_county(), so this warns and names them.
Value
x with suppressed counts filled in and two new columns,
cases_source and cases_uncapped. cases_source is:
"published": CDC's count."state_rate"or"zero": filled in bymethod."not estimated":"state_rate"couldn't estimate it (NA, or 0 withunestimated = "zero"), or it had no count and wasn't marked "Data suppressed" (alwaysNA)."not available": kept withnot_available = "keep";NA.
cases_uncapped is, for rows filled in by "state_rate", the estimate
before cap and floor were applied: the state rate times the county
population used (CDC's or ACS). It is a modeled number, not CDC's hidden
count and not a way to recover it. It is NA for every other row:
published counts, rows filled in by "zero", and rows marked
"not estimated" or "not available". cases is the value to use;
cases_uncapped shows what decided it:
cases_uncapped > cap: the cap setcases.cases_uncapped < floor: the floor setcases.Otherwise
casesequalscases_uncapped. An estimate exactly equal tocaporfloorwas not changed by it.
With "state_rate", a message says how many suppressed rows were filled
in and, of those, how many had their value set by the cap
(cases_uncapped > cap) and by the floor (cases_uncapped < floor), as
counts and percentages. Rows that could not be estimated are not counted.
A limit that can't set anything (cap = Inf, floor = 0) is not
mentioned, and there is no message when no row was estimated or with
method = "zero". A high percentage for the cap means most estimates
are the cap itself rather than the state rate.
data_status is unchanged, so suppressed rows can still be identified.
cap, floor, population and unestimated apply only to
"state_rate". no_county_cases() and extrapolate_from_county() use
cases and ignore cases_uncapped.
Details
"state_rate" downloads the state data matching x (same diseases, years
and stratification) from CDC AtlasPlus, and with population = "acs" the
tract populations from the Census.
See also
no_county_cases() for cases in state totals that no county
accounts for; extrapolate_from_county() for the next step; the article
"About CDC AtlasPlus data"
for CDC's suppression rules.
Examples
if (FALSE) { # \dontrun{
county <- get_atlas("hiv", "county", 2022, stratify_by = "sex")
county <- impute_suppressed(county)
# How many filled-in rows did the cap (4 by default) decide?
filled <- county[county$cases_source == "state_rate", ]
table(filled$indicator, capped = filled$cases_uncapped > 4)
# Sensitivity analysis: suppressed counties have no cases
county_zero <- impute_suppressed(
get_atlas("hiv", "county", 2022, stratify_by = "sex"),
method = "zero"
)
} # }
