segregation.aspatial.MultiDiversity¶
-
class
segregation.aspatial.
MultiDiversity
(data, groups, normalized=False)[source]¶ Calculation of Multigroup Diversity index
- Parameters
- dataa pandas DataFrame
- groupslist of strings.
The variables names in data of the groups of interest of the analysis.
Notes
Based on Reardon, Sean F., and Glenn Firebaugh. “Measures of multigroup segregation.” Sociological methodology 32.1 (2002): 33-67 and Theil, Henry. “Statistical decomposition analysis; with applications in the social and administrative sciences”. No. 04; HA33, T4.. 1972.
This is also know as Theil’s Entropy Index (Equation 2 of page 37 of Reardon, Sean F., and Glenn Firebaugh. “Measures of multigroup segregation.” Sociological methodology 32.1 (2002): 33-67)
High diversity means less segregation.
Reference: [RF02].
Examples
In this example, we are going to use 2000 Census Tract Data for Sacramento MSA, CA. The groups of interest are White, Black, Asian and Hispanic population.
Firstly, we need to perform some import the modules and the respective function.
>>> import libpysal >>> import geopandas as gpd >>> from segregation.multigroup_aspatial import MultiDiversity
Then, we read the data and create an auxiliary list with only the necessary columns for fitting the index.
>>> input_df = gpd.read_file(libpysal.examples.get_path("sacramentot2.shp")) >>> groups_list = ['WHITE_', 'BLACK_', 'ASIAN_','HISP_']
The value is estimated below.
>>> index = MultiDiversity(input_df, groups_list) >>> index.statistic 0.9733112243997906
You can also fit the normalized version of the multigroup diversity index.
>>> normalized_index = Multi_Diversity(input_df, groups_list, normalized = True) >>> normalized_index.statistic 0.7020956383415715
- Attributes
- statisticfloat
Multigroup Diversity Index
- core_dataa pandas DataFrame
A pandas DataFrame that contains the columns used to perform the estimate.
-
__init__
(data, groups, normalized=False)[source]¶ Initialize self. See help(type(self)) for accurate signature.
Methods
__init__
(data, groups[, normalized])Initialize self.