to_influence() reformats a network into the influence network
that the opinion models of play_opinion() use,
in which each node divides its attention among the nodes it listens to.
The result is a directed, weighted network whose weights are
the row-stochastic influence matrix W:
the ties that each node sends sum to 1.
A tie from i to j means that i listens to j, and its weight is the share of i's attention that goes to j. A self-loop is the weight that a node gives to its own current opinion, its self-weight, so a loop of weight 2 on a node with one other tie of weight 1 gives that node a self-weight of 2/3. A node that sends no tie listens only to itself, and so gets a self-weight of 1.
A negative tie is a tie of repulsion: the node moves away from the opinion of the node it is tied to, towards the opposite opinion. Its weight in W is negative, and the absolute weights of the ties that each node sends sum to 1, as in the model of Altafini (2013). Opposite opinions are opposite signs, so the opinions should then be on a scale centred on 0, such as from -1 to 1.
Unlike the as_*() group of functions,
this function returns the same class as it is given.
For a matrix, it returns W itself.
to_influence(.data, weights = NULL)An object of a {manynet}-consistent class:
adjacency or incidence matrix from {base} R
edgelist data.frame from {base} R or tbl/tbl_df from {tibble}
stocnet stocnet, from the {manynet} package
igraph igraph, from the {igraph} package
network network, from the {network} package
tidygraph tbl_graph, from the {tidygraph} package
How the influence of one node on another is weighed.
By default NULL, which uses the ties of the network,
with their weights where the network is weighted,
normalised so that the ties each node sends sum to 1.
Self-loops are kept as self-weights.
Otherwise the name of a numeric tie attribute to weigh the ties by,
or a matrix with one row and column for each node,
whose absolute values sum to 1 in each row, which is used as it is.
A negative value is a tie of repulsion.
A directed, weighted network of the same class, whose tie weights are the influence matrix W.
An object of the same class as the function was given, modified as explained in the function description, details, or section. Functions that split a network return a list of such objects.
Not all functions have methods available for all object classes. Below are the currently implemented S3 methods:
Altafini, Claudio. 2013. "Consensus problems on networks with antagonistic interactions", IEEE Transactions on Automatic Control, 58(4): 935-946. doi:10.1109/TAC.2012.2224251
Other ties:
manip_ties_attr,
manip_ties_num,
modif_backbone,
modif_direction,
modif_weight
Other modifications:
modif_backbone,
modif_concepts,
modif_direction,
modif_from_parts,
modif_from_ternary,
modif_labels,
modif_layers,
modif_levels,
modif_loops,
modif_miss,
modif_motifs,
modif_paths,
modif_permutation,
modif_project,
modif_proximity,
modif_scope,
modif_split,
modif_weight
to_influence(ison_adolescents)
as_matrix(to_influence(ison_adolescents))
#> Betty Sue Alice Jane Dale Pam Carol Tina
#> Betty 0.00 1.0000000 0.0000000 0.0000000 0.00 0.00 0.0000000 0.0
#> Sue 0.25 0.0000000 0.2500000 0.0000000 0.25 0.25 0.0000000 0.0
#> Alice 0.00 0.2500000 0.0000000 0.2500000 0.25 0.25 0.0000000 0.0
#> Jane 0.00 0.0000000 0.5000000 0.0000000 0.50 0.00 0.0000000 0.0
#> Dale 0.00 0.3333333 0.3333333 0.3333333 0.00 0.00 0.0000000 0.0
#> Pam 0.00 0.3333333 0.3333333 0.0000000 0.00 0.00 0.3333333 0.0
#> Carol 0.00 0.0000000 0.0000000 0.0000000 0.00 0.50 0.0000000 0.5
#> Tina 0.00 0.0000000 0.0000000 0.0000000 0.00 0.00 1.0000000 0.0
# A negative tie repels
as_matrix(to_influence(irps_wwi))
#> GBR FRA RUS AUH DEU ITA
#> GBR 0.00 0.00 0.0 -0.3333333 -0.3333333 -0.3333333
#> FRA 0.00 0.00 0.0 -0.3333333 -0.3333333 -0.3333333
#> RUS 0.00 0.00 0.0 0.0000000 0.0000000 -1.0000000
#> AUH -0.25 -0.25 0.0 0.0000000 0.2500000 0.2500000
#> DEU -0.25 -0.25 0.0 0.2500000 0.0000000 0.2500000
#> ITA -0.20 -0.20 -0.2 0.2000000 0.2000000 0.0000000