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:
- df
geopandas.GeoDataFrame
geodataframe with population data to be randomized
- group
str
,optional
name of column on geodataframe that holds the group total (for use with single group indices)
- total
str
,optional
name of column on geodataframe that holds the total population for each unit (for use with single group indices)
- groups
list
,optional
list of columns on input dataframe that hold total population counts for each group of interest
- df
- 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