• 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_x_exposure(.data)

net_x_hazard(.data)

Source

{netdiffuseR}

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

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.

Examples

node_x_exposure(play_diffusion(create_tree(12)))
#> # A tibble: 12 × 4
#>      t0    t1    t2    t3
#>   <dbl> <dbl> <dbl> <dbl>
#> 1     0     2     2     2
#> 2     1     1     3     3
#> 3     1     1     3     3
#> 4     0     1     1     3
#> 5     0     1     1     3
#> 6     0     1     1     2
#> # ℹ 6 more rows
# To calculate the hazard rates at each time point
  smeg <- generate_smallworld(15, 0.025)
net_x_hazard(play_diffusion(smeg, transmissibility = 0.3))
#> # A tibble: 1 × 12
#>      t0    t1     t2     t3    t4    t5    t6    t7    t8    t9   t10   t11
#>   <dbl> <dbl>  <dbl>  <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1    NA 0.143 0.0833 0.0909   0.3 0.286   0.2  0.25 0.333     0   0.5     1