segregation.local.MultiLocalDiversity

class segregation.local.MultiLocalDiversity(data, groups)[source]

Calculation of Local Diversity index for each group and unit

Parameters
dataa pandas DataFrame of n rows
groupslist of strings of length k.

The variables names in data of the groups of interest of the analysis.

Notes

Based on Theil, Henry. Statistical decomposition analysis; with applications in the social and administrative sciences. No. 04; HA33, T4.. 1972.

Reference: [The72].

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.local import MultiLocalDiversity

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 = MultiLocalDiversity(input_df, groups_list)
>>> index.statistics[0:10] # Values of first 10 units
array([0.34332326, 0.56109229, 0.70563225, 0.29713472, 0.22386084,
       0.29742517, 0.12322789, 0.11274579, 0.09402405, 0.25129616])
Attributes
statisticsnp.array(n,k)

Local Diversity values for each group and unit

core_dataa pandas DataFrame

A pandas DataFrame that contains the columns used to perform the estimate.

__init__(data, groups)[source]

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__(data, groups)

Initialize self.