package version 0.3.0 built 2019-05-22
Skye Bender deMoll (skyebend@uw.edu) and the statnet team (http://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 Mon May 27 13:02:03 2019
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.
library(tsna)
Loading required package: network
network: Classes for Relational Data
Version 1.15 created on 2019-04-01.
copyright (c) 2005, Carter T. Butts, University of California-Irvine
Mark S. Handcock, University of California -- Los Angeles
David R. Hunter, Penn State University
Martina Morris, University of Washington
Skye Bender-deMoll, University of Washington
For citation information, type citation("network").
Type help("network-package") to get started.
Loading required package: networkDynamic
networkDynamic: version 0.10.0, created on 2019-04-04
Copyright (c) 2019, Carter T. Butts, University of California -- Irvine
Ayn Leslie-Cook, University of Washington
Pavel N. Krivitsky, University of Wollongong
Skye Bender-deMoll, University of Washington
with contributions from
Zack Almquist, University of California -- Irvine
David R. Hunter, Penn State University
Li Wang
Kirk Li, University of Washington
Steven M. Goodreau, University of Washington
Jeffrey Horner
Martina Morris, University of Washington
Based on "statnet" project software (statnet.org).
For license and citation information see statnet.org/attribution
or type citation("networkDynamic").
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.
?tsna
?tPath
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.
library(networkDynamicData)
library(sna)
Loading required package: statnet.common
Attaching package: 'statnet.common'
The following object is masked from 'package:base':
order
sna: Tools for Social Network Analysis
Version 2.4 created on 2016-07-23.
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.
data(moodyContactSim)
plot(moodyContactSim,displaylabels = TRUE,main='aggregate network')
We can view the activity spells associated with the network’s edges
as.data.frame(moodyContactSim)
onset terminus tail head onset.censored terminus.censored duration
1 40 72 10 4 FALSE FALSE 32
2 214 247 1 11 FALSE FALSE 33
3 224 256 7 10 FALSE FALSE 32
4 453 479 13 4 FALSE FALSE 26
5 494 524 13 2 FALSE FALSE 30
6 575 599 2 16 FALSE FALSE 24
7 583 615 1 16 FALSE FALSE 32
8 621 651 1 12 FALSE FALSE 30
9 634 660 13 3 FALSE FALSE 26
10 665 692 4 14 FALSE FALSE 27
11 674 701 1 9 FALSE FALSE 27
12 701 733 16 6 FALSE FALSE 32
13 709 740 2 15 FALSE FALSE 31
14 712 739 13 5 FALSE FALSE 27
15 719 745 8 13 FALSE FALSE 26
16 748 782 4 16 FALSE FALSE 34
17 749 793 11 8 FALSE FALSE 44
18 769 795 13 7 FALSE FALSE 26
edge.id
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
11 11
12 12
13 13
14 14
15 15
16 16
17 17
18 18
Since this is a fairly simple network, we could plot the times on the aggregate network diagram as edge labels.
coords<-plot(moodyContactSim,
displaylabels=TRUE,
label.cex=0.8,
label.pos=5,
vertex.col='white',
vertex.cex=3,
edge.label=sapply(get.edge.activity(moodyContactSim),function(e){
paste('(',e[,1],'-',e[,2],')',sep='')
}),
edge.label.col='blue',
edge.label.cex=0.7
)
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.
par(mfcol=c(1,2))
plot(network.extract(moodyContactSim,at=215),
main='network at time 215',
displaylabels=TRUE,
label.cex=0.6,
label.pos=5,
vertex.col='white',
vertex.cex=3,
coord=coords)
plot(network.extract(moodyContactSim,at=750),
main='network at time 750',
displaylabels=TRUE,
label.cex=0.6,
label.pos=5,
vertex.col='white',
vertex.cex=3,
coord=coords)