Learn R Programming

segregation (version 0.0.1)

mutual_difference: Decomposes the difference between two M indices

Description

Uses the method developed by Mora and Ruiz-Castillo (2009).

Usage

mutual_difference(data1, data2, unit, group, weight = NULL, method = "mrc",
  se = FALSE, n_bootstrap = 50)

Arguments

data1

A data frame with same structure as data2.

data2

A data frame with same structure as data1.

unit

A categorical variable or a vector of variables contained in data. Defines the first dimension over which segregation is computed.

group

A categorical variable or a vector of variables contained in data. Defines the second dimension over which segregation is computed.

weight

Numeric. Only frequency weights are allowed. (Default NULL)

method

for now, only "mrc" (Mora and Ruiz-Castillo, 2009) is possible

se

If TRUE, standard errors are estimated via bootstrap. (Default FALSE)

n_bootstrap

Number of bootstrap iterations. (Default 50)

Value

Returns a data frame with columns stat and est. The data frame contains the following rows defined by stat: M1 contains the M for data1. M2 contains the M for data2. diff is the difference between M2 and M1. unit_entropy is the difference in unit entropy. group_marginal is the contribution of group composition differences. invariant is the contribution of group composition-invariant differences. Note that diff = unit_entropy + group_marginal + invariant

If se is set to TRUE, an additional column se contains the associated bootstrapped standard errors, and the column est contains bootstrapped estimates.

References

Ricardo Mora and Javier Ruiz-Castillo. 2009. "The Invariance Properties of the Mutual Information Index of Multigroup Segregation". Research on Economic Inequality 17: 33-53.

Examples

Run this code
# NOT RUN {
mutual_difference(schools00, schools05, unit="race", group="school",
    weight="n", method="mrc")
# }

Run the code above in your browser using DataLab