segregation.inference.simulate_person_permutation

segregation.inference.simulate_person_permutation(df, group=None, total=None, groups=None)[source]

Simulate the permutation of individuals across spatial units.

Parameters:
dfgeopandas.GeoDataFrame

geodataframe with population data to be randomized

groupstr, optional

name of column on geodataframe that holds the group total (for use with single group indices)

totalstr, optional

name of column on geodataframe that holds the total population for each unit (for use with single group indices)

groupslist, optional

list of columns on input dataframe that hold total population counts for each group of interest

Returns:
geopandas.GeoDataFrame

geodataframe with randomly reallocated population

Notes

Simulates the random permutation of the existing population’s location. Given a pool of the total population in the region, randomly allocate each person to a geographic unit, subject to the total capacity of each unit. Results are guaranteed to respect regional and local totals for geographic units as well as regional totals and relative shares for groups