duration {tsna} | R Documentation |
Compute Observed Activity Durations or Event Counts for Edges or Vertices
Description
Computes observed activity durations or event counts for edges or vertices, aggregating at the edges, spell, or dyads level.
Usage
edgeDuration(nd, mode = c("duration", "counts"), subject = c("edges", "spells", "dyads"),
e = seq_along(nd$mel), start = NULL, end = NULL, active.default = TRUE)
vertexDuration(nd, mode = c("duration", "counts"), subject = c("vertices", "spells"),
v = seq_len(network.size(nd)), active.default = TRUE)
Arguments
nd |
networkDynamic object to be evaluated |
mode |
option determining if the |
subject |
option describing the unit of analysis that the durations or counts should be aggregated at. |
e |
numeric vector of edge ids to consider. |
v |
numeric vector of vertex ids to consider. |
start |
optional numeric value to be used to censor onset times. (not yet supported for vertices, must use |
end |
optional numeric value to be used to censor terminus times. (not yet supported for vertices, must use |
active.default |
logial, should edges or vertices with no timing information be considered always active by default? |
Details
The function sums the durations of edge or vertex events or,in order to provide a useful metric for networks having zero-duration events, simply counts them. It is implemented by wrapping a call to as.data.frame.networkDynamic
or get.vertex.activity
. In many cases the output of the function will be fed to another statistical summary function like summary
or hist
. The level of aggregation can be selected by setting the subject to either spells
, edges
, or dyads
.
Note that the 'observed' durations may not match the 'true' (statistically estimated) durations for a network due to the censoring of edges/vertices.
Value
A vector of values corresponding to the selected subjects with the count or duration of events. If the network contains no edges/vertices, numeric(0)
will be returned.
Note
This is an early implementation of the function and its name and arguments are subject to change
Author(s)
skyebend
See Also
See also as.data.frame.networkDynamic
Examples
# look at the distributions of edge durations for
# a real-world contact network
## Not run:
require(networkDynamicData)
data(hospital_contact)
summary(edgeDuration(hospital,subject='edges'))
summary(edgeDuration(hospital,mode='counts',subject='edges'))
## End(Not run)
# look at the vertex durations for a network were
# vertices are not present every day
require(networkDynamic)
data(windsurfers)
vertexDuration(windsurfers)