tErgmStats: Calculate network summary statistics at multiple time points

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/summaryStats.R

Description

Applies a ergm-style formula of network statistics to cross-sectional networks collapsed from a networkDynamic at multiple time points to construct a matrix of values describing the change in statistics over time.

Usage

1
tErgmStats(nd, formula, start, end, time.interval = 1, aggregate.dur, rule)

Arguments

nd

networkDynamic object to be evaluated

formula

a character string providing an ergm term name or the 'right hand side' of an ergm formula. For example '~ edges + concurrent'

start

optional numeric time value at which evaluation should start (default is first observed time)

end

optional numeric time value at which evaluation should end (default is last observed time)

time.interval

optional numeric value giving time interval between evaluations (default is 1)

aggregate.dur

optional numeric value giving the duration of time bin to aggregate over for each evaluation (default 0). See network.collapse

rule

character vector describing rule to be used if multiple attribute values are encountred when using non-zero aggregate.dur. Default is latest. See network.collapse for details

Details

Constructs a set of times to evaluate based on start,end and time.interval. Extracts a static network at each time point and uses it to construct a formula with f. The formula is passed to ergm's summary_formula function to calculate the net value of the change statistics for each term in the formula. The values of the statistics are grouped into a time-series object (class ts). The ts object can be thought of as a matrix such that each column is a formula term and each row is the time point at which the statistics were evaluated. See ergm-terms for a list of available term statistics. The aggregate.dur can be used to specifiy the duration of the aggregation bin, especially useful when working with continuous time networks. Usually the time.interval would be set to the same value to ensure non-overlapping bins.

Be aware that if the network's vertex activity dynamics imply cross-sectional networks of different sizes, the interpretation of the statistic at each time point may not be the same.

Value

A time-series (ts) object containing term statistics in which each column corresponds to a statistic and each row is the time point at which the statistic was evaluated

Author(s)

skyebend@uw.edu

See Also

See also summary_formula and ergm-terms. For more information about time-series objects, see ts and plot.ts for plotting quickly plotting timelines for multiple statistics. The summary_formula.networkDynamic function in the tergm package offers very similar functionality.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
 ## Not run: 
 data(windsurfers)
 tErgmStats(windsurfers,'~edges+degree(c(1,2))')
 library(networkDynamicData)
 data(concurrencyComparisonNets)
 tErgmStats(base,'~edges+concurrent',
               start=0,end=100,time.interval = 10)
 # show as multiple plots
 plot(
   tErgmStats(base,'~edges+concurrent',
                start=0,end=100,time.interval = 10),
                
                )
  
## End(Not run)

 

Example output

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").

Time Series:
Start = 0 
End = 31 
Frequency = 1 
   edges degree1 degree2
 0    15       1       0
 1    24       1       1
 2    38       1       1
 3    34       1       3
 4     9       0       7
 5     6       1       1
 6    33       0       3
 7    42       2       4
 8    15       0       0
 9    96       0       0
10    83       4       4
11    16       1       3
12     6       1       2
13    16       0       3
14     7       1       3
15     7       2       2
16    55       1       2
17    47       1       1
18     8       2       1
19    21       0       0
20    31       0       0
21    40       1       1
22     8       0       1
23    93       0       2
24     0       0       0
25     8       3       2
26     9       1       1
27     0       0       0
28    17       2       0
29    11       2       0
30    79       3       0
31     0       0       0
Warning message:
'summary.statistics.formula' is deprecated.
See help("Deprecated") 
Time Series:
Start = 0 
End = 100 
Frequency = 0.1 
    edges concurrent
  0   371        186
 10   377        186
 20   363        154
 30   376        162
 40   373        166
 50   368        169
 60   380        181
 70   401        203
 80   406        191
 90   398        189
100   372        166

tsna documentation built on Nov. 1, 2021, 5:06 p.m.