assort: Assortativity Coefficient

Description Usage Arguments Details Value References See Also Examples

View source: R/assort.R

Description

Assortativity coefficient is a measure of segregation for social networks due to Newman & Girvan (2002).

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
assort(object, ...)

## S3 method for class 'table'
assort(object, ...)

## S3 method for class 'igraph'
assort(object, vattr, ...)

## Default S3 method:
assort(object, ...)

Arguments

object

R object, see available methods

...

other arguments to/from other methods

vattr

character, name of the vertex attribute for which the measure is to be calculated

Details

The measure evaluates the relative prevalence of within-group ties. It is based on the contact layer of the mixing matrix.

Assortativity coefficient is 1 if all ties are within-group. The minimum can be negative, but not less than -1, and depends on the relative number of ties of nodes in different groups. If the network conforms to "proportionate mixing", the coefficient is 0.

If object is a table it is interpreted as a mixing matrix. Two-dimensional table is interpreted as a contact layer. Three-dimensional table is interpreted as a full mixing matrix m[ghy] cross-classyfying all dyads, in which g and h correspond to group membership of ego and alter respectively. Layers y=1 and y=2 are assumed to be non-contact and contact layers respectively.

If object is of class "igraph" it is required to supply vattr with the name of the vertex attribute to calculate intermediate mixing matrix.

For any other classes, object is coerced to a table and the table method is called.

Value

Numeric value of the index.

References

Newman, M. J. and Girvan, M. (2002) "Mixing patterns and community structure in networks", arXiv:cond-mat/0210146v1

Newman, M. J. (2003) "Mixing patterns in networks" arXiv:cond-mat/0209450v2

See Also

Mixing matrices: mixingm()

Other segregation measures: coleman(), ei(), freeman(), gamix(), orwg(), smi(), ssi()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
assort(WhiteKinship, "gender")
assort(EF3, "type")

# Values of `assort()` for full networks of different sizes
if( requireNamespace("igraph", quietly = TRUE) ) {
  f <- function(n) {
    gfull <- igraph::make_full_graph(n, directed=FALSE)
    igraph::V(gfull)$type <- rep(1:2, length = igraph::vcount(gfull))
    assort(gfull, "type")
  }
  set.seed(1)
  x <- sort(sample(5:100, 25) * 2)
  y <- sapply(x, f)
  plot(x, y, type="o",
       xlab="Network size", ylab="Assortativity coefficient",
       main="Assortativity coef. for full networks of different sizes")
}

netseg documentation built on Feb. 17, 2021, 9:06 a.m.