infection(graph, toa, t0 = NULL, normalize = TRUE, K = 1L, r = 0.5,
expdiscount = FALSE, valued = getOption("diffnet.valued", FALSE))susceptibility(graph, toa, t0 = NULL, normalize = TRUE, K = 1L, r = 0.5,
expdiscount = FALSE, valued = getOption("diffnet.valued", FALSE))
netdiffuseR-graphs
).toa_mat
.expdiscount=TRUE
expdiscount=TRUE
, $w_k = (1 + r)^{k-1}$, otherwise
it will be $w_k = k$.Note that when $K=1$, the above formulas are equal to the ones presented in Valente et al. (2015).
normalize=TRUE
, is applied by dividing the
resulting number from the infectiousness/susceptibility stat
by the number of individuals who adopted the innovation at
time $t$.Given that node $i$ adopted the innovation in time $t$, its Susceptibility is calculated as follows
$$S_i = \frac{\sum_{k=1}^K\sum_{j=1}^n x_{ij(t-k+1)}z_{j(t-k)}\times \frac{1}{w_k}}{\sum_{k=1}^K\sum_{j=1}^n x_{ij(t-k+1)}z_{j(1\leq t \leq t-k)} \times \frac{1}{w_k} }\qquad \mbox{for }i,j=1,\dots,n\quad i\neq j$$
where $x_{ij(t-k+1)}$ is 1 whenever there's a link from $i$ to $j$ at time $t-k+1$, $z_{j(t-k)}$ is 1 whenever individual $j$ adopted the innovation at time $t-k$, $z_{j(1\leq t \leq t-k)}$ is 1 whenever $j$ had adopted the innovation up to $t-k$, and $w_k$ is the discount rate used (see below).
Similarly, infectiousness is calculated as follows
$$I_i = \frac{\sum_{k=1}^K \sum_{j=1}^n x_{ji(t+k-1)}z_{j(t+k)}\times \frac{1}{w_k}}{\sum_{k=1}^K \sum_{j=1}^n x_{ji(t+k-1)}z_{j(t+k\leq t \leq T)}\times \frac{1}{w_k} }\qquad \mbox{for }i,j=1,\dots,n\quad i\neq j$$
It is worth noticing that, as we can see in the formulas, while susceptibility is from alter to ego, infection is from ego to alter.
Finally, by default both are normalized by the number of individuals who
adopted the innovation in time $t-k$. Thus, the resulting formulas,
when normalize=TRUE
, can be rewritten as
$$S_i' = \frac{S_i}{\sum_{k=1}^K\sum_{j=1}^nz_{j(t-k)}\times \frac{1}{w_k}}\qquad I_i' = \frac{I_i}{\sum_{k=1}^K\sum_{j=1}^nz_{j(t-k)} \times\frac{1}{w_k}}$$
For more details on these measurements, please refer to the vignette titled Time Discounted Infection and Susceptibility.
Myers, D. J. (2000). "The Diffusion of Collective Violence: Infectiousness, Susceptibility, and Mass Media Networks". American Journal of Sociology, 106(1), 173–208. doi:10.1086/303110
plot_infectsuscep
Other statistics: cumulative_adopt_count
,
dgr
, exposure
,
hazard_rate
, moran
,
struct_equiv
, threshold
# Creating a random dynamic graph
set.seed(943)
graph <- rgraph_er(n=100, t=10)
toa <- sample.int(10, 100, TRUE)
# Computing infection and susceptibility (K=1)
infection(graph, toa)
susceptibility(graph, toa)
# Now with K=4
infection(graph, toa, K=4)
susceptibility(graph, toa, K=4)
Run the code above in your browser using DataLab