- segregation.inference.sim_composition(df1, df2, group_pop_var1, total_pop_var1, group_pop_var2, total_pop_var2)¶
Simulate the spatial distribution of a population group in 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 composition with the value of the corresponding percentile in region 2. The composition is the minority population of unit i divided by total population of tract i. This approach will shift the relative composition of each spatial unit without changing its total population.
dataframe for first dataset with columns holding group and total population counts
dataframe for second dataset with columns holding group and total population counts
column holding population counts for group of interest on input df1
column holding total population counts on input df1
column holding population counts for group of interest on input df2
column holding total population counts on input df2
dataframes with simulated population columns appended