met.affinity: Affinity

View source: R/met.affinity.R

met.affinityR Documentation

Affinity

Description

Calculates the node metric affinity for all the nodes of the network

Usage

met.affinity(M, df = NULL, dfid = NULL, binary = FALSE)

Arguments

M

a square adjacency matrix, or a list of square adjacency matrices, or an output of ANT functions stat.ds.grp, stat.df.focal, stat.net.lk.

df

a data frame of same length as the input matrix or a list of data frames if argument M is a list of matrices or an output of ANT functions stat.ds.grp, stat.df.focal, stat.net.lk.

dfid

an integer or a string indicating the column with individual ids in argument df.

binary

a boolean, if TRUE, it calculates the binary version of the affinity.

Details

Affinity is a second-order metric that evaluates how alters of node i are connected. The binary version is the average degree of alters of node i. The weighted version is the ratio between the metric reach and the strength of node i. A high affinity reveals that nodes tend to be connected to alters with high degrees or strengths. Thus, this metric informs on node assortativity by vertex met.degree, i.e. connections between nodes with similar degrees or strengths.

Value

  • An integer vector of nodes affinity if argument df is NULL.

  • A list of integer vectors of nodes affinity if argument M is a list of matrices and if argument df is NULL.

  • A list of arguments df with a new column for nodes affinity if argumentdf is not NULL. The name of the column is adapted according to argument value binary.

  • A list of arguments df with a new column for nodes affinity if 1) argument df is not NULL, 2) argument M is an output from ANT functions stat.ds.grp, stat.df.focal, stat.net.lk for multiple matrices permutations, and 3) argument df is a list of data frames of same length as argument M.The names of the column of each element of the list is adapted according to argument value binary.

Author(s)

Sebastian Sosa, Ivan Puga-Gonzalez.

References

Whitehead, H. A. L. (1997). Analysing animal social structure. Animal behaviour, 53(5), 1053-1067.

Sosa, S. (2018). Social Network Analysis, in: Encyclopedia of Animal Cognition and Behavior. Springer.

Examples

met.affinity(sim.m)
head(sim.df)
met.affinity(sim.m,df=sim.df)

SebastianSosa/ant documentation built on Sept. 23, 2023, 7:06 a.m.