randomizetimes {timeordered} | R Documentation |
Resamples data based on event time.
Description
Produces a new event list from an existing event list with resampled event times given certain constraints on randomization. Effectively re-orders pairs of start/stop times between different vertices.
Usage
randomizetimes(raw, withinvertexfrom, byvertexfrom, withreplacement)
Arguments
raw |
A raw event list to be resampled. Contains four columns: VertexFrom, VertexTo, TimeStart, TimeStop |
withinvertexfrom |
If true, resamples within data subsets where VertexFrom is fixed; otherwise resamples within all data. |
byvertexfrom |
If true, subsets of data for withinvertexfrom are obtained using VertexFrom; if false, using VertexTo. |
withreplacement |
Samples with or without replacement. |
Value
An event list of the same size as raw with event times resampled. Resampling does not break the relationship between start and stop time; i.e. resampled events will have the same duration as original events.
Author(s)
Benjamin Blonder bblonder@email.arizona.edu.
See Also
Examples
data(ants)
allindivs <- c(union(ants$VertexFrom, ants$VertexTo), "NULL1", "NULL2")
rt <- randomizetimes(ants,withinvertexfrom=TRUE,byvertexfrom=TRUE,withreplacement=TRUE)
g <- generatetonetwork(rt, allindivs)
plottonet(g)