segregation.inference.simulate_evenness

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

Simulate even redistribution of population groups 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 evenly distributed population groups

Notes

Simulates the random allocation of groups, given the total population of each geographic unit (randomizes group totals for each location). Given the total population of each location, take draws from a multinomial distribution to assign group categories for each person, where the probability of each group is equal to its regional share. Results are guaranteed to match local population totals, but will include variation in the regional totals for each group