play | R Documentation |
Functions to play games on networks
play_diffusion(
.data,
seeds = 1,
thresholds = 1,
transmissibility = 1,
latency = 0,
recovery = 0,
waning = 0,
immune = NULL,
steps
)
play_diffusions(
.data,
seeds = 1,
thresholds = 1,
transmissibility = 1,
latency = 0,
recovery = 0,
waning = 0,
immune = NULL,
steps,
times = 5,
strategy = "sequential",
verbose = FALSE
)
play_learning(.data, beliefs, steps, epsilon = 5e-04)
play_segregation(
.data,
attribute,
heterophily = 0,
who_moves = c("ordered", "random", "most_dissatisfied"),
choice_function = c("satisficing", "optimising"),
steps
)
.data |
An object of a
|
seeds |
A valid mark vector the length of the number of nodes in the network. |
thresholds |
A numeric vector indicating the thresholds each node has. By default 1. A single number means a generic threshold; for thresholds that vary among the population please use a vector the length of the number of nodes in the network. If 1 or larger, the threshold is interpreted as a simple count of the number of contacts/exposures sufficient for infection. If less than 1, the threshold is interpreted as complex, where the threshold concerns the proportion of contacts. |
transmissibility |
A proportion indicating the transmission rate,
|
latency |
A proportion indicating the rate at which those exposed
become infectious (infected), |
recovery |
A proportion indicating the rate of recovery,
|
waning |
A proportion indicating the rate at which those who are
recovered become susceptible again, |
immune |
A logical or numeric vector identifying nodes that begin the diffusion process as already recovered. This could be interpreted as those who are vaccinated or equivalent. Note however that a waning parameter will affect these nodes too. By default NULL, indicating that no nodes begin immune. |
steps |
The number of steps forward in the diffusion to play.
By default the number of nodes in the network.
If |
times |
Integer indicating number of simulations used for quantile estimation.
(Relevant to the null hypothesis test only -
the analysis itself is unaffected by this parameter.)
Note that, as for all Monte Carlo procedures, convergence is slower for more
extreme quantiles.
By default, |
strategy |
If |
verbose |
Whether the function should report on its progress.
By default FALSE.
See |
beliefs |
A vector indicating the probabilities nodes put on some outcome being 'true'. |
epsilon |
The maximum difference in beliefs accepted for convergence to a consensus. |
attribute |
A string naming some nodal attribute in the network. Currently only tested for binary attributes. |
heterophily |
A score ranging between -1 and 1 as a threshold for how heterophilous nodes will accept their neighbours to be. A single proportion means this threshold is shared by all nodes, but it can also be a vector the same length of the nodes in the network for issuing different thresholds to different nodes. By default this is 0, meaning nodes will be dissatisfied if more than half of their neighbours differ on the given attribute. |
who_moves |
One of the following options: "ordered" (the default) checks each node in turn for whether they are dissatisfied and there is an available space that they can move to, "random" will check a node at random, and "most_dissatisfied" will check (one of) the most dissatisfied nodes first. |
choice_function |
One of the following options: "satisficing" (the default) will move the node to any coordinates that satisfy their heterophily threshold, whereas "optimising" will move the node to coordinates that are most homophilous. |
play_diffusion()
: Playing compartmental diffusion on networks.
play_diffusions()
: Playing multiple compartmental diffusions on networks.
play_learning()
: Playing DeGroot learning on networks.
play_segregation()
: Playing Schelling segregation on networks.
Other models:
regression
,
tests
smeg <- manynet::generate_smallworld(15, 0.025)
plot(play_diffusion(smeg))
plot(play_diffusion(smeg, recovery = 0.4))
plot(play_diffusions(smeg, times = 20))
play_learning(ison_networkers,
rbinom(manynet::network_nodes(ison_networkers),1,prob = 0.25))
startValues <- rbinom(100,1,prob = 0.5)
startValues[sample(seq_len(100), round(100*0.2))] <- NA
latticeEg <- manynet::create_lattice(100)
latticeEg <- manynet::add_node_attribute(latticeEg, "startValues", startValues)
latticeEg
play_segregation(latticeEg, "startValues", 0.5)
#manynet::autographr(latticeEg, node_color = "startValues", node_size = 5)
#manynet::autographr(play_segregation(latticeEg, "startValues", 0.5),
# node_color = "startValues", node_size = 5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.