Calculate homophily in multi-edge graphs.
The function calculates homophily matrices. If you supply a categorical variable (factor, character), the function returns attribute matches for dyads from the same group. If you supply a continuous variable (numeric, integers), the function returns absolute difference effects for each dyad in the graph.
homophily_stat( variable = variable, type = "categorical", nodes = nodes, these.categories.only = NULL, zero_values = NULL )
A attribute variable. Can be categorical (attribute matches) or continuous (absolute difference effects).
categorical. Can be set to
absdiffinstead. If set to
categorical, the homophily statistic calculates matches between dyads from the same group (analogous to dummy variables measuring attribute match between two nodes (=10) and attribute mismatch (=1)). If set to
absdiffit calculates the difference in values from variable for each dyad in the graph.
optional character/factor vector. If an edgelist is provied, you have to provide a list of unique identifiers of your nodes in the graph. This is because in the edgelist, isolates are usually not recorded. If you do not specify isolates in your nodes object, they are excluded from the analysis (falsifies data).
optional vector specifying the categories to be used, if only a subset of factor(variable) is needed.
optional numeric value. Use this to substitute zero-values in your reciprocity change statistic matrix. Zero values in the predictors are recognized in the gHypEG regression as structural zeros. To ensure this does not happen, please recode your zero-values in all your predictors. If
zero_valuesis not specified, the minmal value divided by 10 is used instead.
Homophily change statistic matrix.