toa_diff | R Documentation |
Creates an n \times n
matrix, or for Q
behaviors, a list
of length Q
containing n \times n
matrices, that indicates
the difference in adoption times between each pair of nodes.
toa_diff(obj, t0 = NULL, labels = NULL)
obj |
Either an integer vector of length |
t0 |
Integer scalar. Sets the lower bound of the time window (e.g. 1955). |
labels |
Character vector of length |
Each cell ij
of the resulting matrix is calculated as toa_j - toa_i
, so that whenever its positive it means that the j-th individual (alter)
adopted the innovation sooner.
An n \times n
anti-symmetric matrix (or a list of them,
for Q
behaviors) indicating the difference in times of
adoption between each pair of nodes.
George G. Vega Yon, Thomas W. Valente, and AnĂbal Olivera M.
# For a single behavior -----------------------------------------------------
# Generating a random vector of time
set.seed(123)
times <- sample(2000:2005, 10, TRUE)
# Computing the TOA differences
toa_diff(times)
# For Q=2 behaviors ---------------------------------------------------------
# Generating a matrix time
times_1 <- c(2001L, 2004L, 2003L, 2008L)
times_2 <- c(2001L, 2005L, 2006L, 2008L)
times <- matrix(c(times_1, times_2), nrow = 4, ncol = 2)
# Computing the TOA differences
toa_diff(times)
# Or, from a diffnet object
graph <- lapply(2001:2008, function(x) rgraph_er(4))
diffnet <- new_diffnet(graph, times)
# Computing the TOA differences
toa_diff(diffnet)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.