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

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

  • node_adopter(): Classifies membership of nodes into diffusion categories

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

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

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

  • node_is_exposed(): Marks the nodes that are susceptible, i.e. are in the immediate neighbourhood of given mark vector

node_adoption_time(diff_model)

node_adopter(diff_model)

node_thresholds(diff_model)

node_infection_length(diff_model)

node_exposure(.data, mark, time = 0)

Arguments

diff_model

A valid network diffusion model, as created by as_diffusion() or play_diffusion().

.data

An object of a {manynet}-consistent class:

  • matrix (adjacency or incidence) from {base} R

  • edgelist, a data frame from {base} R or tibble from {tibble}

  • igraph, from the {igraph} package

  • network, from the {network} package

  • tbl_graph, from the {tidygraph} package

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.

Adoption time

node_adoption_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.

Adopter class

node_adopter() classifies the nodes involved in a diffusion by where on the distribution of adopters they fell. Valente (1995) defines five memberships:

  • Early adopter: those with an adoption time less than the average adoption time minus one standard deviation of adoptions times

  • Early majority: those with an adoption time between the average adoption time and the average adoption time minus one standard deviation of adoptions times

  • Late majority: those with an adoption time between the average adoption time and the average adoption time plus one standard deviation of adoptions times

  • Laggard: those with an adoption time greater than the average adoption time plus one standard deviation of adoptions times

  • Non-adopter: those without an adoption time, i.e. never adopted

Thresholds

node_thresholds() 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.

Infection length

node_infection_length() 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

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

Examples

  smeg <- manynet::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_adoption_time(smeg_diff))
#>      V1    V2    V3    V4    V5    V6    V7    V8    V9   V10   V11   V12   V13
#> 1     0   Inf   Inf   Inf   Inf   Inf   Inf   Inf   Inf   Inf   Inf   Inf   Inf
#> # ... with 2 more values from this nodeset unprinted. Use `print(..., n = Inf)` to print all values.
  # To classify nodes by their position in the adoption curve
  (adopts <- node_adopter(smeg_diff))
#>   V1     V2    V3    V4    V5    V6    V7    V8    V9    V10   V11   V12   V13  
#> 1 Early… Non-… Non-… Non-… Non-… Non-… Non-… Non-… Non-… Non-… Non-… Non-… Non-…
#> # ... with 2 more values from this nodeset unprinted. Use `print(..., n = Inf)` to print all values.
  summary(adopts)
#> Class Early Adopter:  1
#> Class Non-Adopter:  2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
  summary(times, membership = adopts)
#> Early Adopter   Non-Adopter 
#>             0           Inf 
  # To infer nodes' thresholds
  node_thresholds(smeg_diff)
#>      V1    V2    V3    V4    V5    V6    V7    V8    V9   V10   V11   V12   V13
#> 1   Inf   Inf   Inf   Inf   Inf   Inf   Inf   Inf   Inf   Inf   Inf   Inf   Inf
#> # ... with 2 more values from this nodeset unprinted. Use `print(..., n = Inf)` to print all values.
  # To measure how long each node remains infected for
  node_infection_length(smeg_diff)
#>      V1    V2    V3    V4    V5    V6    V7    V8    V9   V10   V11   V12   V13
#> 1     1    NA    NA    NA    NA    NA    NA    NA    NA    NA    NA    NA    NA
#> # ... with 2 more values from this nodeset unprinted. Use `print(..., n = Inf)` to print all values.
  # To measure how much exposure nodes have to a given mark
  node_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
#> # ... with 2 more values from this nodeset unprinted. Use `print(..., n = Inf)` to print all values.
  node_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
#> # ... with 2 more values from this nodeset unprinted. Use `print(..., n = Inf)` to print all values.