segregation.aspatial.MultiRelativeDiversity¶
-
class
segregation.aspatial.
MultiRelativeDiversity
(data, groups)[source]¶ Calculation of Multigroup Relative 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. “Measures of racial diversity and segregation in multigroup and hierarchically structured populations.” annual meeting of the Eastern Sociological Society, Philadelphia, PA. 1998.
High diversity means less segregation.
Reference: [Rea98].
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 MultiRelativeDiversity
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 = MultiRelativeDiversity(input_df, groups_list) >>> index.statistic 0.15820019878220337
- Attributes
- statisticfloat
Multigroup Relative Diversity Index
- core_dataa pandas DataFrame
A pandas DataFrame that contains the columns used to perform the estimate.
Methods
__init__
(data, groups)Initialize self.