Returns the total segregation between `group`

and `unit`

.
If `within`

is given, calculates segregation within each
`within`

category separately, and takes the weighted average.
Also see `mutual_within`

for detailed within calculations.

mutual_total(data, group, unit, within = NULL, weight = NULL, se = FALSE, n_bootstrap = 10, base = exp(1))

data | A data frame. |
---|---|

group | A categorical variable or a vector of variables
contained in |

unit | A categorical variable or a vector of variables
contained in |

within | A categorical variable or a vector of variables
contained in |

weight | Numeric. Only frequency weights are allowed.
(Default |

se | If |

n_bootstrap | Number of bootstrap iterations. (Default |

base | Base of the logarithm that is used in the calculation. Defaults to the natural logarithm. |

Returns a data.table with two rows. The column `est`

contains
the Mutual Information Index, M, and Theil's Entropy Index, H. The H is the
the M divided by the `group`

entropy. If `within`

was given,
M and H are weighted averages of the within-category segregation scores.
If `se`

is set to `TRUE`

, an additional column `se`

contains
the associated bootstrapped standard errors, and the column `est`

contains
bootstrapped estimates.

Henri Theil. 1971. Principles of Econometrics. New York: Wiley.

Ricardo Mora and Javier Ruiz-Castillo. 2011. "Entropy-based Segregation Indices". Sociological Methodology 41(1): 159–194.

# calculate school racial segregation mutual_total(schools00, "school", "race", weight="n") # M => .425#> stat est #> 1: M 0.42553898 #> 2: H 0.05642991# note that the definition of groups and units is arbitrary mutual_total(schools00, "race", "school", weight="n") # M => .425#> stat est #> 1: M 0.4255390 #> 2: H 0.4188083# if groups or units are defined by a combination of variables, # vectors of variable names can be provided - # here there is no difference, because schools # are nested within districts mutual_total(schools00, "race", c("district", "school"), weight="n") # M => .424#> stat est #> 1: M 0.4255390 #> 2: H 0.4188083# estimate standard errors for M and H mutual_total(schools00, "race", "school", weight="n", se=TRUE)#> stat est se #> 1: M 0.4292972 0.0008483900 #> 2: H 0.4225433 0.0007267075# estimate segregation within school districts mutual_total(schools00, "race", "school", within="district", weight="n") # M => .087#> stat est #> 1: M 0.08758648 #> 2: H 0.08620114# estimate between-district racial segregation mutual_total(schools00, "race", "district", weight="n") # M => .338#> stat est #> 1: M 0.3379525 #> 2: H 0.3326072# note that the sum of within-district and between-district # segregation equals total school-race segregation; # here, most segregation is between school districts