This package provides an R implementation of the netinf algorithm created by @gomez2010inferring (see here for more information and the original C++ implementation). Given a set of events that spread between a set of nodes the algorithm infers the most likely stable diffusion network that is underlying the diffusion process.
The package can be installed from CRAN:
The latest development version can be installed from github:
To get started, get your data into the cascades format
required by the netinf function:
library(NetworkInference)
# Simulate random cascade data
df <- simulate_rnd_cascades(50, n_node = 20)
# Cast data into `cascades` object
## From long format
cascades <- as_cascade_long(df)
## From wide format
df_matrix <- as.matrix(cascades) ### Create example matrix
cascades <- as_cascade_wide(df_matrix)Then fit the model:
| origin_node | destination_node | improvement | p_value |
|---|---|---|---|
| 1 | 14 | 338.7 | 8.857e-07 |
| 20 | 5 | 313.8 | 9.041e-07 |
| 7 | 17 | 281.4 | 7.508e-06 |
| 15 | 2 | 271.6 | 1.876e-05 |
| 8 | 3 | 265.6 | 1.941e-05 |
| 7 | 9 | 264.6 | 1.896e-05 |