• net_by_hazard() measures the hazard rate or instantaneous probability that nodes will adopt/become infected at that time.

  • node_by_exposure() produces a motif matrix of nodes' exposure to infection/adoption by time step.

node_by_exposure(.data)

net_by_hazard(.data)

Source

{netdiffuseR}

Arguments

.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

Hazard rate

The hazard rate is the instantaneous probability of adoption/infection at each time point (Allison 1984). In survival analysis, hazard rate is formally defined as:

$$% \lambda(t)=\lim_{h\to +0}\frac{F(t+h)-F(t)}{h}\frac{1}{1-F(t)} % $$

By approximating \(h=1\), we can rewrite the equation as

$$% \lambda(t)=\frac{F(t+1)-F(t)}{1-F(t)} % $$

If we estimate \(F(t)\), the probability of not having adopted the innovation in time \(t\), from the proportion of adopters in that time, such that \(F(t) \sim q_t/n\), we now have (ultimately for \(t>1\)):

$$% \lambda(t)=\frac{q_{t+1}/n-q_t/n}{1-q_t/n} = \frac{q_{t+1} - q_t}{n - q_t} = \frac{q_t - q_{t-1}}{n - q_{t-1}} % $$

where \(q_i\) is the number of adopters in time \(t\), and \(n\) is the number of vertices in the graph.

The shape of the hazard rate indicates the pattern of new adopters over time. Rapid diffusion with convex cumulative adoption curves will have hazard functions that peak early and decay over time. Slow concave cumulative adoption curves will have hazard functions that are low early and rise over time. Smooth hazard curves indicate constant adoption whereas those that oscillate indicate variability in adoption behavior over time.

References

On hazard rates

Allison, Paul D. 1984. Event history analysis: Regression for longitudinal event data. London: Sage Publications. doi:10.4135/9781412984195

Wooldridge, Jeffrey M. 2010. Econometric Analysis of Cross Section and Panel Data (2nd ed.). Cambridge: MIT Press.

See also

Examples

node_by_exposure(play_diffusion(create_tree(12)))
#> # A tibble: 12 × 3
#>      t0    t1    t2
#>   <dbl> <dbl> <dbl>
#> 1     0     2     2
#> 2     1     1     3
#> 3     1     1     3
#> 4     0     1     1
#> 5     0     1     1
#> 6     0     1     1
#> # ℹ 6 more rows
# To calculate the hazard rates at each time point
  smeg <- generate_smallworld(15, 0.025)
net_by_hazard(play_diffusion(smeg, transmissibility = 0.3))
#> # A tibble: 1 × 10
#>      t0     t1     t2    t3    t4    t5    t6    t7    t8    t9
#>   <dbl>  <dbl>  <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1    NA 0.0714 0.0769 0.167   0.1 0.556  0.75     0     0     0