Uses the method developed by Mora and Ruiz-Castillo (2009).
mutual_difference(data1, data2, unit, group, weight = NULL, method = "mrc",
se = FALSE, n_bootstrap = 50)
A data frame with same structure as data2
.
A data frame with same structure as data1
.
A categorical variable or a vector of variables
contained in data
. Defines the first dimension
over which segregation is computed.
A categorical variable or a vector of variables
contained in data
. Defines the second dimension
over which segregation is computed.
Numeric. Only frequency weights are allowed.
(Default NULL
)
for now, only "mrc" (Mora and Ruiz-Castillo, 2009) is possible
If TRUE
, standard errors are estimated via bootstrap.
(Default FALSE
)
Number of bootstrap iterations. (Default 50
)
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.
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.
# NOT RUN {
mutual_difference(schools00, schools05, unit="race", group="school",
weight="n", method="mrc")
# }
Run the code above in your browser using DataLab