The EI-Index is the division of the surplus count intra-group edges over inter-group edges, divided by total count of all edges. This implementation uses the intra-group and inter-group density instead of edge counts, when rescale is set to TRUE (default). The EI-Index is calculated for the whole network and for subgroups. Alternatively, the EI index can be employed as a measurement for egos tendency to homo-/heterophily - use comp_ei(). for that variant of the EI-Index.

EI(object, alt.attr, include.ego = FALSE, ego.attr = alt.attr, rescale = TRUE)



An egor object.


Character naming grouping variable.


Logical. Include or exclude ego from EI calculation.


Character, naming the ego variable corresponding to ego.attr. Defaults to ego.attr.


Logical. If TRUE, the EI index calculation is re-scaled, so that the EI is not distorted by differing group sizes.


Returns tibble with the following columns:

  • ego ID (".egoID")

  • network EI-Index ("ei")

  • subgroup EI-Index values (named by value levels of alt.attr/ego.attr)


The whole network EI is a metric indicating the tendency of a network to be clustered by the categories of a given factor variable (alt.attr). The EI value of a group describes the tendency of that group within a network to be connected (if between 0 and 1) or not connected (if between -1 and 0) to other groups. Differing group sizes can lead to a distortion of EI values i.e. the ability of a big group A to form relationships to much smaller group B is limited by the size of B. Even when all possible edges between A and B exist, the EI value for group A might still be negative, classifying it as homophile. The re-scaled EI-Index values provided by this implementation substitutes absolute edge counts by inter- and intra-group edge densities in order to avoid the distortion of the EI-Index values. These values express the extend of homo- or heterophily of the network and its subgroups, as made possible by subgroup sizes.


Krackhardt, D., Stern, R.N., 1988. Informal networks and organizational crises: an experimental simulation. Social Psychology Quarterly 51 (2), 123-140.

Everett, M. G., & Borgatti, S. P. (2012). Categorical attribute based centrality: E-I and G-F centrality. Social Networks, 34(4), 562-569.

See also

comp_ei(), for an ego level homophily measure.


EI(egor32, "sex")
#> # A tibble: 32 × 4
#>    .egoID       ei        m        w
#>     <dbl>    <dbl>    <dbl>    <dbl>
#>  1      1 -0.123   -0.167   -0.100  
#>  2      2 -0.0608  -0.0323  -0.0667 
#>  3      3 -0.122   -0.190    0.448  
#>  4      4 -0.231   -0.0323  -0.263  
#>  5      5  0.0448  -0.0141   0.111  
#>  6      6  0.141   -0.00917  0.674  
#>  7      7  0.00705 -0.119    0.0389 
#>  8      8 -0.123    0.0588  -0.355  
#>  9      9 -0.0606  -0.181    0.00990
#> 10     10 -0.0286  -0.25     0.0370 
#> # … with 22 more rows