segregation.inference.sim_share¶
- segregation.inference.sim_share(df1, df2, group_pop_var1, total_pop_var1, group_pop_var2, total_pop_var2)[source]¶
Simulate the spatial population distribution of a region using the CDF of a comparison region.
For each spatial unit i in region 1, take the unit’s percentile in the distribution, and swap the group share with the value of the corresponding percentile in region 2. The share is the minority population of unit i divided by total population of minority population. This approach will shift the total population of each unit without changing the regional proportion of each group
- Parameters:
- df1
pandas.DataFrame
orgeopandas.GeoDataFrame
dataframe for first dataset with columns holding group and total population counts
- df2
pandas.DataFrame
orgeopandas.GeoDataFrame
dataframe for second dataset with columns holding group and total population counts
- group_pop_var1
str
column holding population counts for group of interest on input df1
- total_pop_var1
str
column holding total population counts on input df1
- group_pop_var2
str
column holding population counts for group of interest on input df2
- total_pop_var2
str
column holding total population counts on input df2
- df1
- Returns:
two
pandas.DataFrame
dataframes with simulated population columns appended