segregation.decomposition.DecomposeSegregation

class segregation.decomposition.DecomposeSegregation(index1, index2, counterfactual_approach='composition')[source]

Decompose segregation differences into spatial and attribute components.

Given two segregation indices of the same type, use Shapley decomposition to measure whether the differences between index measures arise from differences in spatial structure or population structure

Parameters:
index1segregation.SegIndex class

First SegIndex class to compare.

index2segregation.SegIndex class

Second SegIndex class to compare.

counterfactual_approachstr, one of {“composition”, “share”, “dual_composition”}

The technique used to generate the counterfactual population distributions.

Attributes:
c_sfloat

Shapley’s Spatial Component of the decomposition

c_afloat

Shapley’s Attribute Component of the decomposition

indicesdict

Dictionary of index values for all four combinations of spatial/attribute data

__init__(index1, index2, counterfactual_approach='composition')[source]

Initialize class.

Methods

__init__(index1, index2[, ...])

Initialize class.

plot([plot_type, figsize, city_a, city_b, ...])

Plot maps or CDFs of urban contexts used in calculating the Decomposition class.

plot(plot_type='cdfs', figsize=None, city_a=None, city_b=None, cmap='OrRd', scheme='equalinterval', k=10, suptitle_size=16, title_size=12, savefig=None, dpi=300)[source]

Plot maps or CDFs of urban contexts used in calculating the Decomposition class.

Parameters:
plot_typestr, {‘cdfs, ‘maps’}

which type of plot to generate. Options include cdfs and maps by default “cdfs”

figsizetuple, optional

figsize parameter passed to matplotlib.pyplot

city_astr, optional

Name of the first “city” to be used in plotting. If None, defaults to ‘City A’

city_bstr, optional

Name of the second “city” to be used in plotting. If None, defaults to ‘City B’

cmapstr, optional

matplotlib colormap used to shade the map, by default “OrRd”

schemestr, optional

pysal.mapclassify classification scheme used to shade the map, by default “equalinterval”

kint, optional

number of classes in pysal.mapclassify classification scheme, by default 10

suptitle_sizeint, optional

size parameter passed to matplotlib.Figure.suptitle, by default 16

title_sizeint, optional

size parameter passed to matplotlib.Axes.set_title, by default 12

savefigstr, optional

Location to save the figure if desired. If None, fig will not be saved

dpiint, optional

dpi parameter passed to matplotlib.pyplot, by default 300

Returns:
None

Generates a new matplotlib.Figure instance and optionally saves to disk