tsna : Tools for Temporal Social Network Analysis

package version 0.3.5 built 2021-10-31

Skye Bender deMoll (skyebend@uw.edu) and the statnet team (https://statnet.org). Major contributions from James Moody, Martina Morris, Carter Butts, Steve Goodreau, Samuel Jenness, Li Wang and Kirk Li. This work was supported by grant R01HD68395 from the National Institute of Health.

Documentation compiled Sun Oct 31 08:32:29 2021


This package provides tools for working with dynamic networks (or processes on networks) in which the ordering and timing of ties is important. These approaches are needed when the phenomena of interest involve networks having densities and edge-turnover rates in a parameter space such that the time-collapsed aggregate network give too great a distortion of the toplology connectivity for useful analysis.

Most tsna functions accept as their input continuous- and discrete-time longitudinal networks having vertex, edge, and attribute dynamics stored in the networkDynamic format. tsna includes tools for applying "traditional" static Social Network Analysis (SNA) metrics at multiple time points, as well as temporal extensions of SNA metrics using forwards- and backwards-path routines. The initial version of tsna is primarily focused on working with networks of the type that might be generated from discrete time simulations of network evolution.

Research on formal methods for analysis of longitudinal networks is a relatively new area of study. Many of the measures included in this package may be formally identical to measures already published with different names in literature of diverse research fields. We will attempt to find and cite such previous work, but if you encounter any omissions, please let us know.


This document assumes familiarity with general concepts of SNA, R, and the statnet suite of R packages. For more background on the network and networkDynamic data structures and functions, please see appropriate package documentation and tutorials.

Loading required package: network

'network' 1.17.1 (2021-06-12), part of the Statnet Project
* 'news(package="network")' for changes since last version
* 'citation("network")' for citation information
* 'https://statnet.org' for help, support, and other information
Loading required package: networkDynamic

'networkDynamic' 0.11.0 (2021-06-12), part of the Statnet Project
* 'news(package="networkDynamic")' for changes since last version
* 'citation("networkDynamic")' for citation information
* 'https://statnet.org' for help, support, and other information

As always in R, a general help file for the package can be displayed, and the individual arguments for each function are documented in more detail in the function's help page.


This vignette also makes use of various example data sets provided by the networkDynamicData package, and optionally employs static Social Network Analysis measures provided by the sna package.

Loading required package: statnet.common

Attaching package: 'statnet.common'
The following objects are masked from 'package:base':

    attr, order
sna: Tools for Social Network Analysis
Version 2.6 created on 2020-10-5.
copyright (c) 2005, Carter T. Butts, University of California-Irvine
 For citation information, type citation("sna").
 Type help(package="sna") to get started.


Most of the tsna package function assume that their input is formatted as a networkDynamic data structure. The networkDynamic package provides utilities (networkDynamic()) for converting data from various formats (such as timed edge-lists, or lists of matrices) as well as functions for manipulating the data structures.

The data structure provided by networkDynamic objects assumes that the vertices and (directed or non-directed) edges of a network have multiple 'activity spells' associated with them indicating when they are 'active' or exist within the observation period. Each spell is an interval with an onset and terminus time. Each edge or vertex can activate and deactivate multiple times during the period over which the network is observed. Please see ?activate for additional details.

As an example, consider the included moodyContactSim example object (Moody 2008). We will first plot it as a time-aggregated network, ignoring the temporal info and showing all of the edges that are ever active.

plot(moodyContactSim,displaylabels = TRUE,main='aggregate network')

We can view the activity spells associated with the network's edges

   onset terminus tail head onset.censored terminus.censored duration edge.id
1     40       72   10    4          FALSE             FALSE       32       1
2    214      247    1   11          FALSE             FALSE       33       2
3    224      256    7   10          FALSE             FALSE       32       3
4    453      479   13    4          FALSE             FALSE       26       4
5    494      524   13    2          FALSE             FALSE       30       5
6    575      599    2   16          FALSE             FALSE       24       6
7    583      615    1   16          FALSE             FALSE       32       7
8    621      651    1   12          FALSE             FALSE       30       8
9    634      660   13    3          FALSE             FALSE       26       9
10   665      692    4   14          FALSE             FALSE       27      10
11   674      701    1    9          FALSE             FALSE       27      11
12   701      733   16    6          FALSE             FALSE       32      12
13   709      740    2   15          FALSE             FALSE       31      13
14   712      739   13    5          FALSE             FALSE       27      14
15   719      745    8   13          FALSE             FALSE       26      15
16   748      782    4   16          FALSE             FALSE       34      16
17   749      793   11    8          FALSE             FALSE       44      17
18   769      795   13    7          FALSE             FALSE       26      18

Since this is a fairly simple network, we could plot the times on the aggregate network diagram as edge labels.


In situations when we are considering transmission processes on a dynamic network, the aggregate network is not a good representation because it exaggerates the connectivity in the network by ignoring the importance of the order of edge events (Moody, 2002). For example, the apparent 8 to 11 to 1 path appears to be the shortest path traverseable in the static aggregate network. But when we consider the constraints of edge activity, the edge between 1 and 11 becomes inactive long before the edge between 8 and 11 activates, there is no such path in the dynamic network.

We could go to the other extreme, and instead of looking at the aggregate network we view only the network that is actually active at a single point in time. These networks will be much less connected than time-collapsed network. We see the edge between 1 and 11, and the edge between 11 and 8, but is difficult to determine any connectivity at all for the network as a whole.

     main='network at time 215',
     main='network at time 750',