I am working on calculating the Dissimilarity Index (DI) in a multigroup analysis using Carlos Gradin's codes for measuring local segregation, which is based on the method developed by Alonso-Villar & Del Rio (2010)'s Method. However, the local segregation results from the code do not provide the DI for each group (in my case, male and female).
I attempted to manually implement the DI formula from Alonso-Villar & Del Rio (2010), but the results I obtained are not within the expected range of 0 to 1. My dataset consists of individual-level observations. Here is the code I used:
Can anyone help me figure out why my DI results are incorrect?
I attempted to manually implement the DI formula from Alonso-Villar & Del Rio (2010), but the results I obtained are not within the expected range of 0 to 1. My dataset consists of individual-level observations. Here is the code I used:
Code:
gen count = 1 #Calculate the Total Number of Males and Females (JK) in Each Category (combination between occupations and industries): bysort composite_category JK: egen group_in_category = total(count) #Calculate Overall Totals for Males and Females bysort JK: egen group_total = total(count) #Proportion of males or females in each category gen prop_group_in_category = group_in_category / group_total #Calculate the Total Number of Individuals in Each Category bysort composite_category: egen total_in_category = total(count) #Calculate the Population for the Other gen rest_in_category = total_in_category - group_in_category #Proportion of the other in each category gen prop_rest_in_category = rest_in_category / (group_total) #Calculate the absolute difference between the two proportions gen abs_diff = abs(prop_group_in_category - prop_rest_in_category) #Sum Up the Absolute Differences Across All Categories: bysort composite_category: egen category_abs_diff = total(abs_diff)
Comment