Method: Proportional, resident-estimate-adjusted parcel unit counts
Source:R/redistribute_parcel_pums_adj.R
redistribute_parcel_pums_adj.Rd
A wrapper around the redistribute
function, that
takes PUMS data as additional input, and uses it to calculates an adjusted weight for
redistribution to parcel data.
Usage
redistribute_parcel_pums_adj(source, target, households,
target_total = "Total_Units", target_indicator = "Unit_Type",
households_size = "size", households_indicator = "BLD",
households_id = "SERIALNO", person = NULL,
person_household_id = "SERIALNO", ...)
Arguments
- source, target
Source and target of
redistribute
.- households
PUMS household data. Can be a list with
household
andperson
entries, like that returned fromdownload_census_pums
.- target_total
Column name in
target
(e.g., parcel data; or equivalent vector) containing the unit count- target_indicator
Column name of a logical variable in
target
(or equivalent vector) to use to assign adjustment values, whereTRUE
indicates a single family home. If the values of the column are characters, anything not matching"MULTI"
will beTRUE
.- households_size
A vector of household sizes, or a column in
households
containing such values. If this is not specified or found,person
will be used to calculate household size, based onhosuehold_id
andperson_household_id
.- households_indicator
Same a
target_indicator
, but inhouseholds
, or a vector (or column name) of BLD codes, where either"02"
or"03"
would beTRUE
.- households_id
A vector of household IDs aligning with
households
, or a column name inhouseholds
containing such IDs. Only used to calculatehouseholds_size
if necessary.- person
PUMS person data. Only used to calculate
households_size
if necessary.- person_household_id
A vector of household IDs aligning with
person
, or a column name inperson
containing such IDs. Only used to calculatehouseholds_size
if necessary.- ...
Additional arguments to pass to
redistribute
. You will likely need to specify amap
, and potentiallysource_id
and/ortarget_id
.
Value
Result of redistribute
. These are assumed to be parcel-level
estimates, which could then be aggregated to make higher-level estimates.
Details
It is assumed that initial weights are unit counts, and these are to be adjusted based on PUMS household data.
Examples
if (FALSE) {
if (require("tidycensus")) {
# download source, target, and household data
tracts <- tidycensus::get_acs(
year = 2021,
state = "51",
county = "013",
geography = "tract",
output = "wide",
variables = c(total = "B01001_001"),
geometry = TRUE
)
parcels <- sf::st_read(paste0(
"https://arlgis.arlingtonva.us/arcgis/rest/",
"services/Open_Data/od_MHUD_Polygons/",
"FeatureServer/0/query?where=1=1&outFields=*&outSR=4326&f=json"
))
pums <- download_census_pums(tempdir(), "51", geoids = tracts$GEOID)
# calculate map between source and target
map_tr_to_parcel <- redistribute(
tracts, parcels,
target_id = "OBJECTID", return_map = TRUE
)
# redistribute tract-level summaries to parcels,
# using a resident-estimate-adjusted weight
parcels_filled <- redistribute_parcel_pums_adj(
tracts[, -2], parcels, pums,
map = map_tr_to_parcel, target_id = "OBJECTID"
)
# this can also be calculated with the underlying function
## calculate resident estimates
household_size <- tapply(
table(pums$person$SERIALNO)[pums$household$SERIALNO],
pums$household$BLD %in% c("02", "03"),
mean,
na.rm = TRUE
)
residents <- parcels$Total_Units * household_size[
as.character(parcels$Unit_Type != "MULTI")
]
## supply as weights
parcels_filled_manual <- redistribute(
tracts[, -2], parcels, map_tr_to_parcel,
target_id = "OBJECTID", weight = residents
)
# either way, you could now use the result to make estimates
# at higher-level geographies by redistributing from the
# parcel-level estimates to the new target
}
}