Function reference

Find and understand the data

The catalog of datasets, a search across every variable, each dataset’s documentation, its variable dictionary, the actual years behind each stored year, and how to cite it.

datasets The catalog: one row per dataset and scale.
search Find variables whose name, label or description contain every word of text.
info What a dataset is: description, coverage (scales, units, years), actual reference
dictionary The variable dictionary of a dataset, one row per column.
reference_years The actual years behind each stored year, one row per variable and stored year.
cite How to cite a dataset: its recommended citation, then the credits its sources require.
labels Readable labels for the columns of a panel (or every field of a dataset id).
describe Summary statistics of a panel’s variables, per by group (default: per year).

Load data, units and boundaries

Panels with one row per unit and year, the units of every scale with their names and codes, their boundaries, and the links between scales.

load Load a dataset as a panel: one row per unit (geo_id) and year.
add_names Add the unit name and, for each scale in groups, the name of the unit it lies in.
units All units (or the units of one scale) with names, parents and source keys.
boundaries Unit polygons for a scale (CRS84), with geo_id and name.
crosswalk Links between two scales: geo_id_from, geo_id_to, weight_area.
scales The registry of spatial scales (geo/scales.yaml).
ancestors Coarser scales a unit of scale nests in, in breadth-first order.
scale_of The scale a geo ID belongs to, from the ID patterns (e.g. a municipality ID -> "municipality").
config The project settings: the package’s project.yaml, with the data repository’s on top inside a checkout.

Work with panels and scales

The change of each unit between two years, aggregation up the hierarchy with the rule each variable declares, several datasets on one scale, and area-weighted transfer to units that do not nest.

change The change of each unit between two years of a panel, one row per unit.
aggregate Moving data between spatial scales.
combine Merge datasets into one panel at scale, aggregating finer ones up.
overlay Area-weighted interpolation of a panel onto non-nested units.
overlay_weights Area of every source-target intersection, in an equal-area projection.

Build your own indicators

Link a table of your own to the geo IDs, check it, compute zonal statistics from a raster, and save the result as a documented dataset.

link Attach geo_id to a table that identifies units by name or by a source code.
check Problems that would stop df from being a valid panel at scale (empty list = OK).
zonal Summarise a raster (GeoTIFF path or URL) over the units of a scale.
save Save a panel exactly like the published datasets, ready to share or contribute.

Explore

A first look at any variable without using space: correlations, the highest and lowest units, distributions, relationships and trends.

correlation Correlations between the variables of a panel in one year.
extremes The units with the highest and the lowest values of a variable in one year.
distribution The distribution of a variable across units, per year or per group.
scatter Two variables against each other in one year, one point per unit.
trend A variable over time: its mean (or median) across units, with a band, and each unit’s path.

Maps and spatial dependence

Interactive maps (continuous, classed, side by side or of the change), spatial weights and their neighbour graph, global Moran’s I and LISA cluster maps.

map An interactive choropleth map (Plotly) of one variable: in one year, in several years side by
weights Spatial weights for the units of a scale, a dataset or a panel.
connectivity A map of the neighbour links of a set of weights, with the distribution of neighbours per unit.
moran Global Moran’s I of a variable: is it clustered in space?
lisa Local Moran (LISA) clusters of a variable: where are the hot spots, cold spots and outliers?

Convergence

β-convergence with ordinary or spatial estimators, σ-convergence (the trend of dispersion) and Phillips–Sul convergence clubs.

beta_convergence Beta-convergence: did the units that started lower grow faster between two years?
sigma_convergence Sigma-convergence: does the dispersion of a variable across units fall over time?
convergence_clubs Convergence clubs (Phillips and Sul): do all units converge, or do groups of them?

Transitions and mobility

How units move within the distribution: Markov and spatial Markov transition matrices, transitions between LISA cluster types, and rank mobility.

transitions Markov transitions between classes of a variable’s distribution: how mobile are the units?
spatial_transitions Spatial Markov transitions: does a unit’s mobility depend on where its neighbours stand?
lisa_transitions Transitions between local Moran (LISA) types: did the hot spots and cold spots persist?
rank_mobility Rank mobility between two years: how much did the units change position?

Inequality

Gini, Theil and the coefficient of variation in each year with the Lorenz curve, and Theil’s decomposition between and within groups of units.

inequality Inequality between units: Gini, Theil and the coefficient of variation in each year,
theil_decomposition Theil’s index split in two: inequality between groups of units and inequality within them.

Models

Regression tables with fixed effects and clustered errors, the standard panel estimators with the Hausman test, and spatial regression with impacts and specification diagnostics.

regression Ordinary least squares, with several specifications side by side.
panel_model The standard panel estimators side by side, and the Hausman test of fixed against random effects.
spatial_model A spatial regression for one year, with direct, indirect (spillover) and total impacts.
spatial_diagnostics Tests for spatial dependence left in a least-squares regression, and the spatial model they point to.

Spatial heterogeneity

Multiscale geographically weighted regression (MGWR): coefficients that vary over space, each at its own spatial scale, with a map per coefficient.

mgwr Multiscale geographically weighted regression: where, and at which scale, does x relate to y?

Companion packages

Hand a panel over to expdpy (panel econometrics) and geometrics (spatial models and teaching tools) for specialised methods.

for_expdpy (df, df_def) in the format expdpy expects.
for_geometrics (gdf, df, df_dict) in the format geometrics expects.