segregation.local.MultiLocationQuotient¶
-
class
segregation.local.
MultiLocationQuotient
(data, groups)[source]¶ Calculation of Location Quotient 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 Isard, Walter. Methods of regional analysis. Vol. 4. Рипол Классик, 1967.
Reference: [Isa67].
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 MultiLocationQuotient
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 = MultiLocationQuotient(input_df, groups_list) >>> index.statistics[0:3,0:3] array([[1.36543221, 0.07478049, 0.16245651], [1.18002164, 0. , 0.14836683], [0.68072696, 0.03534425, 0. ]])
Important to note that column k has the Location Quotient (LQ) of position k in groups. Therefore, the LQ of the first unit of ‘WHITE_’ is 1.36543221.
- Attributes
- statisticsnp.array(n,k)
Location Quotient values for each group and unit. Column k has the Location Quotient of position k in groups.
- core_dataa pandas DataFrame
A pandas DataFrame that contains the columns used to perform the estimate.
Methods
__init__
(data, groups)Initialize self.