Learn R Programming

segregation (version 0.0.1)

mutual_local: Calculates local segregation indices

Description

Returns local segregation indices for each category defined by group.

Usage

mutual_local(data, unit, group, weight = NULL, se = FALSE,
  n_bootstrap = 10)

Arguments

data

A data frame.

unit

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

group

A categorical variable or a vector of variables contained in data. Defines the group for which local segregation indices are calculated.

weight

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

se

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

n_bootstrap

Number of bootstrap iterations. (Default 10)

Value

Returns a data frame with three rows for each category defined by group, for a total of 3*(number of groups) rows. The column est defines three statistics that are provided for each group: ls, the local segregation score, p, the proportion of the group from the total number of cases, and M_group, the product of ls and p. If se is set to TRUE, an additional column se contains the associated bootstrapped standard errors, and the column est contains bootstrapped estimates.

References

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<U+2013>194.

Examples

Run this code
# NOT RUN {
# which racial groups are most segregated?
(localseg = mutual_local(schools00, "school", "race", weight="n"))
# native americans are most segregated, whites are least segregated.

sum(localseg[localseg["stat"]=="p", "est"]) # => 1

# the sum of the weighted local segregation scores equals
# total segregation
mutual_total(schools00, "school", "race", weight="n") # => .425
sum(localseg[localseg["stat"]=="M_group", "est"]) # => .425
# }

Run the code above in your browser using DataLab