tSnaStats {tsna}R Documentation

Apply the sna package's static graph- and vertex-level network descriptive statistics at multiple time points

Description

Samples collapsed static networks at regular intervals along a network dynamic object, applies the named static sna descriptive statistic function to each network, and returns the result as a time series. Additional arguments to the function can be included via ... . Set the sna function's directedness and self-loops flags appropriately by default.

Usage

tSnaStats(nd, snafun, start, end, time.interval = 1, aggregate.dur=0, rule='latest', ...)

Arguments

nd

a networkDynamic object to be evaluated

snafun

character string giving the name of the sna package function to be applied. i.e 'mutuality'

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

...

additional arguments to be passed on to the sna function. See docs for each function for possible arguments.

Details

This wrapper directly calls functions in the sna package, so it will only work if that package is installed. Below is a list of supported functions:

Graph-Level statistics:

Vertex-level statistics:

Most of the sna functions involve converting the network to a matrix and can be quite expensive to calculate for a single time point, so use care when applying to large or long-duration networks.

Some of the sna functions are undefined or produce numerical errors when applied to networks with certain configurations (such as zero edges).

The sna functions generally cannot handle networks with no vertices, so stats will be replaced with NA when they are encountered.

There may be some overlap with ergm terms available through tErgmStats and the ergm version will generally be faster

Value

a ts (time series) object. A matrix in which rows correspond to the time points evaluated and columns correspond to values of statistics produced. In the case of vertex-level indices, there will be one column per vertex. For the census measures, each column will correspond to a census element.

Note

Note that this is an early DRAFT implementation. Does not yet include binning options needed for non-discrete time networks, and has not been tested with networks that have changing vertex activity.

Author(s)

skyebend@uw.edu

References

Carter T. Butts (2014). sna: Tools for Social Network Analysis. R package version 2.3-2. http://CRAN.R-project.org/package=sna

See Also

See also tErgmStats,

Examples

library(networkDynamicData)
data(harry_potter_support)

# compute triad census scores for each time point
tSnaStats(harry_potter_support,snafun='triad.census')

# compute graph transitivities
tSnaStats(harry_potter_support,snafun='gtrans')
## Not run: 
data(concurrencyComparisonNets)
# since thes are big nets, with lots of timepoints, 
# set time.interval to avoid evaluating every step
tSnaStats(base,'prestige',time.interval=25,rescale=TRUE)

# since it is time series, easy to plot
plot(tSnaStats(base,'components',time.interval=10))

## End(Not run)

[Package tsna version 0.3.5 Index]