| compute_lumi | R Documentation |
compute_lumi() reads CNEFE records for a given municipality,
assigns each address point to spatial units (either H3 hexagonal cells or
user-provided polygons), and computes the residential proportion (p_res) and land-use mix
indices, such as the Entropy Index (ei), the Herfindahl-Hirschman Index (hhi),
the Balance Index (bal), the Index of Concentration at Extremes (ice), the adapted HHI (hhi_adp),
and the Bidirectional Global-centered Balance Index (bgbi), following the methodology
proposed in Pedreira Junior et al. (2025, 2026). The 2026 article introduces the BGBI,
and the adapted HHI is documented in the 2025 preprint.
compute_lumi(
code_muni,
year = 2022,
polygon_type = lifecycle::deprecated(),
polygon = NULL,
crs_output = NULL,
h3_resolution = 9,
verbose = TRUE,
cache = TRUE,
cache_dir = NULL,
backend = c("duckdb", "r")
)
code_muni |
Integer. Seven-digit IBGE municipality code. |
year |
Integer. The CNEFE data year. Currently only 2022 is supported. Defaults to 2022. |
polygon_type |
|
polygon |
An |
crs_output |
The CRS for the output object. Only used when |
h3_resolution |
Integer. H3 grid resolution (default: 9). Only used for
the H3 grid, so it is ignored when |
verbose |
Logical; if |
cache |
Logical. If |
cache_dir |
Character. Directory to use for cached downloads. If |
backend |
Character.
If the constraint is memory rather than installability, keep the DuckDB
backend and cap it with the |
The indices computed here rest on a binary split. An address is counted as
residential when COD_ESPECIE == 1 (private household), and as
non-residential otherwise. This follows the formulation of the indices as
published in Pedreira Junior et al. (2026), where the measures are defined
and empirically validated on that two-category basis.
compute_lumi() drops records with COD_ESPECIE == 7 (building under
construction or renovation), because such records describe a transitional
state rather than a realised land use. Note that cnefe_counts() does not
apply this exclusion and reports these records as addr_type7.
Two indices use a citywide residential share P: the bgbi index, which is
referenced against it, and the Balance Index (bal), which uses it through
r = P / (1 - P). The other indices are computed entirely within each spatial
unit. Two properties of P are worth stating.
First, P is computed from CNEFE address-type counts rather than from census population, so it describes the distribution of address types and not the distribution of residents.
Second, P is always computed over the full municipality, including when
polygon is supplied, so it does not adapt to the area the supplied
polygons happen to cover. This is intended, as P describes the context the
addresses sit in, which is the municipality, and a sub-area of a city is
still part of that wider context. A baseline recomputed over the sub-area
would measure something different, namely mix relative to the sub-area
itself rather than relative to the city.
An sf::sf object containing:
polygon is NULL (H3 grid):id_hex: H3 cell identifier
p_res, ei, hhi, bal, ice, hhi_adp, bgbi: land-use
mix indicators
geometry: hexagon geometry (CRS 4326)
polygon is supplied: Original columns from polygon
p_res, ei, hhi, bal, ice, hhi_adp, bgbi: land-use
mix indicators
geometry: polygon geometry (in the original or crs_output CRS)
Pedreira Junior, J. U.; Louro, T. V.; Assis, L. B. M.; Brito, P. L.; Bomfim, F. G. (2026). BGBI: A citywide-referenced and bidirectional land use mix index for planning and policy evaluation. Land Use Policy, 169, 108135. https://doi.org/10.1016/j.landusepol.2026.108135
Pedreira Junior, J. U.; Louro, T. V.; Assis, L. B. M.; Brito, P. L. (2025).
Measuring land use mix with address-level census data.
engrXiv preprint. https://engrxiv.org/preprint/view/5975
(where the adapted HHI (hhi_adp) is documented)
Massey, D. S. (2001). The prodigal paradigm returns: ecology comes back to sociology. In A. Booth & A. C. Crouter (Eds.), Does It Take a Village? Community Effects on Children, Adolescents, and Families. Lawrence Erlbaum.
Song, Y.; Merlin, L.; Rodriguez, D. (2013). Comparing measures of urban land use mix. Computers, Environment and Urban Systems, 42, 1–13. https://doi.org/10.1016/j.compenvurbsys.2013.08.001
# Compute land-use mix indices on H3 hexagons
lumi <- compute_lumi(code_muni = 2929057, cache = FALSE)
# Compute land-use mix indices on user-provided polygons (neighborhoods of Lauro de Freitas-BA)
# Using geobr to download neighborhood boundaries
library(geobr)
nei_ldf <- subset(
read_neighborhood(year = 2022),
code_muni == 2919207
)
lumi_poly <- compute_lumi(
code_muni = 2919207,
polygon = nei_ldf,
cache = FALSE
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.