These functions allow measurement of various features of a diffusion process:

  • node_by_adopt_time(): Measures the number of time steps until nodes adopt/become infected

  • node_by_adopt_threshold(): Measures nodes' thresholds from the amount of exposure they had when they became infected

  • node_by_adopt_recovery(): Measures the average length nodes that become infected remain infected in a compartmental model with recovery

  • node_by_adopt_exposure(): Measures how many exposures nodes have to a given mark

node_by_adopt_time(.data)

node_by_adopt_threshold(.data, normalized = TRUE, lag = 1)

node_by_adopt_recovery(.data)

node_by_adopt_exposure(.data, mark, time = 0)

Arguments

.data

A network object of class mnet, igraph, tbl_graph, network, or similar. For more information on the standard coercion possible, see manynet::as_tidygraph().

normalized

Logical scalar, whether scores are normalized. Different denominators may be used depending on the measure, whether the object is one-mode or two-mode, and other arguments. By default TRUE.

lag

The number of time steps back upon which the thresholds are inferred.

mark

A valid 'node_mark' object or logical vector (TRUE/FALSE) of length equal to the number of nodes in the network.

time

A time point until which infections/adoptions should be identified. By default time = 0.

Value

A node_measure numeric vector the length of the nodes in the network, providing the scores for each node. If the network is labelled, then the scores will be labelled with the nodes' names.

Adoption time

node_by_adopt_time() measures the time units it took until each node became infected. Note that an adoption time of 0 indicates that this was a seed node.

Thresholds

node_by_adopt_threshold() infers nodes' thresholds based on how much exposure they had when they were infected. This inference is of course imperfect, especially where there is a sudden increase in exposure, but it can be used heuristically. In a threshold model, nodes activate when \(\sum_{j:\text{active}} w_{ji} \geq \theta_i\), where \(w\) is some (potentially weighted) matrix, \(j\) are some already activated nodes, and \(theta\) is some pre-defined threshold value. Where a fractional threshold is used, the equation is \(\frac{\sum_{j:\text{active}} w_{ji}}{\sum_{j} w_{ji}} \geq \theta_i\). That is, \(theta\) is now a proportion, and works regardless of whether \(w\) is weighted or not.

Recovery

node_by_adopt_recovery() measures the average length of time that nodes that become infected remain infected in a compartmental model with recovery. Infections that are not concluded by the end of the study period are calculated as infinite.

Exposure

node_exposure() calculates the number of infected/adopting nodes to which each susceptible node is exposed. It usually expects network data and an index or mark (TRUE/FALSE) vector of those nodes which are currently infected, but if a diff_model is supplied instead it will return nodes exposure at \(t = 0\).

References

On diffusion measures

Valente, Tom W. 1995. Network models of the diffusion of innovations (2nd ed.). Cresskill N.J.: Hampton Press.

Examples

  smeg <- generate_smallworld(15, 0.025)
  smeg_diff <- play_diffusion(smeg, recovery = 0.2)
  plot(smeg_diff)

  # To measure when nodes adopted a diffusion/were infected
  (times <- node_by_adopt_time(smeg_diff))
#> ▃▃▃▂ 
#>      V1    V2    V3    V4    V5    V6    V7    V8    V9   V10   V11   V12   V13
#> 1     0     1     1     2     2     3     3     4     4     3     3     2     2
#> # ... and 2 more values from this nodeset. Use `print_all(...)` to print all values.
  # To infer nodes' thresholds
  node_by_adopt_threshold(smeg_diff)
#> ▁▅▃▂ 
#>      V1    V2    V3    V4    V5    V6    V7    V8    V9   V10   V11   V12   V13
#> 1     0  0.25  0.25   0.5  0.25   0.5  0.25  0.75  0.75  0.25   0.5  0.25   0.5
#> # ... and 2 more values from this nodeset. Use `print_all(...)` to print all values.
  # To measure how long each node remains infected for
  node_by_adopt_recovery(smeg_diff)
#> ▅▂▂▁▁▁ 
#>      V1    V2    V3    V4    V5    V6    V7    V8    V9   V10   V11   V12   V13
#> 1     3     2   Inf     2     7     3     9     3     2     6     7    13     5
#> # ... and 2 more values from this nodeset. Use `print_all(...)` to print all values.
  # To measure how much exposure nodes have to a given mark
  node_by_adopt_exposure(smeg, mark = c(1,3))
#> ▆▃▁▁ 
#>      V1    V2    V3    V4    V5    V6    V7    V8    V9   V10   V11   V12   V13
#> 1     0     2     0     1     1     0     0     0     0     0     0     0     0
#> # ... and 2 more values from this nodeset. Use `print_all(...)` to print all values.
  node_by_adopt_exposure(smeg_diff)
#> ▆▁▁▁▃ 
#>      V1    V2    V3    V4    V5    V6    V7    V8    V9   V10   V11   V12   V13
#> 1     0     1     1     0     0     0     0     0     0     0     0     0     0
#> # ... and 2 more values from this nodeset. Use `print_all(...)` to print all values.