mixingm: Network mixing matrix

Description Usage Arguments Details Value Examples

View source: R/mixingm.R

Description

Creating network mixing matrices.

Usage

1
2
3
4
5
mixingm(object, ...)

## S3 method for class 'igraph'
mixingm(object, rattr, cattr = rattr, full = FALSE,
  directed = is.directed(object), loops = any(is.loop(object)), ...)

Arguments

object

R object, see Details for available methods

...

other arguments passed to/from other methods

rattr

name of the vertex attribute or an attribute itself as a vector. If cattr is not NULL, rattr is used for rows of the resulting mixing matrix.

cattr

name of the vertex attribute or an attribute itself as a vector. If supplied, used for columns in the mixing matrix.

full

logical, whether two- or three-dimensional mixing matrix should be returned.

directed

logical, whether the network is directed. By default, directedness of the network is determined with is.directed.

loops

logical, whether loops are allowed. By default it is TRUE whenever there is at least one loop in object.

Details

Network mixing matrix is, traditionally, a two-dimensional cross-classification of edges depending on the values of a specified vertex attribute for tie sender and tie receiver. It is an important tool for assessing network homophily or segregation.

Let G be the number of distinct values of the vertex attribute in question. We may say that we have G mutually exclusive groups in the network. The mixing matrix is a GxG matrix such that m[ij] is the number of ties send by vertices in group i to vertices in group j. The diagonal of that matrix is of special interest as, say, m[ii] is the number of ties within group i.

A full mixing matrix is a three-dimensional array that cross-classifies all network dyads depending on:

  1. the value of the vertex attribute for tie sender

  2. the value of the vertex attribute for tie receiver

  3. the status of the dyad, i.e. whether it is connected or not

The two-dimensional version is a so-called "contact layer" of the three-dimensional version.

If object is of class "igraph," mixing matrix is created for the network in object based on vertex attributes supplied in arguments rattr and optionally cattr.

If only rattr is specified (or, equivalently, rattr and cattr are identical), the result will be a mixing matrix G \times G if full is FALSE or GxGx2 if full is TRUE. Where G is the number of categories of vertex attribute specified by rattr.

If rattr and cattr can be used to specify different vertex attributes for tie sender and tie receiver.

Value

Depending on full argument a two- or three-dimensional array crossclassifying connected or all dyads in object.

For undirected network and if foldit is TRUE (default), the matrix is folded onto the upper triangle (entries in lower triangle are 0).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
if(require(igraph, quietly = TRUE)) {
  # some directed network
  net <- graph(c(1,2, 1,3, 2,3,  4,5,  1,4, 1,5, 4,2, 5,3))
  V(net)$type <- c(1,1,1, 2,2)
  mixingm(net, "type")
  mixingm(net, "type", full=TRUE)
  # as undirected
  mixingm( as.undirected(net), "type")
  mixingm(net, "type")
  mixingm(net, "type", full=TRUE)
}

mbojan/isnar documentation built on Feb. 18, 2021, 4:38 a.m.