Trace {EpiContactTrace} | R Documentation |
Trace Contacts.
Description
Contact tracing for a specied node(s) (root) during a specfied time period. The time period is divided into two parts, one for ingoing contacts and one for outgoing contacts.
Usage
Trace(
movements,
root,
tEnd = NULL,
days = NULL,
inBegin = NULL,
inEnd = NULL,
outBegin = NULL,
outEnd = NULL,
maxDistance = NULL
)
Arguments
movements |
a |
root |
vector of roots to perform contact tracing for. |
tEnd |
the last date to include ingoing and outgoing
movements. Defaults to |
days |
the number of previous days before tEnd to include
ingoing and outgoing movements. Defaults to |
inBegin |
the first date to include ingoing
movements. Defaults to |
inEnd |
the last date to include ingoing movements. Defaults
to |
outBegin |
the first date to include outgoing
movements. Defaults to |
outEnd |
the last date to include outgoing
movements. Defaults to |
maxDistance |
stop contact tracing at maxDistance (inclusive)
from root. Default is |
Details
The time period used for Trace
can either be specified
using tEnd
and days
or inBegin
, inEnd
,
outBegin
and outEnd
.
If using tEnd
and days
, the time period for ingoing
and outgoing contacts ends at tEnd
and starts at
days
prior to tEnd
. The tracing will be performed
for each combination of root
, tEnd
and days
.
An alternative way is to use inBegin
, inEnd
,
outBegin
and outEnd
. The time period for ingoing
contacts starts at inBegin and ends at inEndDate. For outgoing
contacts the time period starts at outBegin and ends at outEnd.
The vectors root
inBegin
, inEnd
,
outBegin
and outEnd
must have the same lengths and
the tracing will be performed for each index of them.
The argument movements in Trace is a data.frame
with the following columns:
- source
-
an integer or character identifier of the source holding.
- destination
-
an integer or character identifier of the destination holding.
- t
-
the Date of the transfer
- id
-
an optional character vector with the identity of the animal.
- n
-
an optional numeric vector with the number of animals moved.
- category
-
an optional character or factor with category of the animal e.g. Cattle.
References
Dube, C., et al., A review of network analysis terminology and its application to foot-and-mouth disease modelling and policy development. Transbound Emerg Dis 56 (2009) 73-85, doi: 10.1111/j.1865-1682.2008.01064.x
Noremark, M., et al., Network analysis of cattle and pig movements in Sweden: Measures relevant for disease control and riskbased surveillance. Preventive Veterinary Medicine 99 (2011) 78-90, doi: 10.1016/j.prevetmed.2010.12.009
Examples
## Load data
data(transfers)
## Perform contact tracing using tEnd and days
trace_1 <- Trace(movements = transfers,
root = 2645,
tEnd = "2005-10-31",
days = 91)
## Perform contact tracing using inBegin, inEnd
## outBegin and outEnd
trace_2 <- Trace(movements = transfers,
root = 2645,
inBegin = "2005-08-01",
inEnd = "2005-10-31",
outBegin = "2005-08-01",
outEnd = "2005-10-31")
## Check that the result is identical
identical(trace_1, trace_2)
## Show result of contact tracing
trace_1
## Create a network summary for 10 of the included herds
## First extract all source and destination from the dataset,
## then select the first ten.
root <- sort(unique(c(transfers$source,
transfers$destination)))
root <- root[1:10]
## Perform contact tracing using tEnd and days.
trace_3 <- Trace(movements = transfers,
root = root,
tEnd = "2005-10-31",
days = 91)
## Perform contact tracing using inBegin, inEnd
## outBegin and outEnd
trace_4 <- Trace(movements = transfers,
root = root,
inBegin = rep("2005-08-01", length(root)),
inEnd = rep("2005-10-31", length(root)),
outBegin=rep("2005-08-01", length(root)),
outEnd=rep("2005-10-31", length(root)))
## Check that the result is identical
identical(trace_3, trace_4)