InDegree
The number of herds with direct movements of animals to the root herd during the defined time window used for tracing.
InDegree(x, ...)# S4 method for Contacts
InDegree(x)
# S4 method for ContactTrace
InDegree(x)
# S4 method for data.frame
InDegree(x, root, tEnd = NULL, days = NULL, inBegin = NULL, inEnd = NULL)
A data.frame
with the following columns:
The root of the contact tracing
The first date to include ingoing movements
The last date to include ingoing movements
The number of days in the interval inBegin to inEnd
The InDegree
of the root within the time-interval
a ContactTrace object, or a list of ContactTrace objects
or a data.frame
with movements of animals between
holdings, see Trace
for details.
Additional arguments to the method
vector of roots to calculate indegree for.
the last date to include ingoing movements. Defaults
to NULL
the number of previous days before tEnd to include
ingoing movements. Defaults to NULL
the first date to include ingoing
movements. Defaults to NULL
the last date to include ingoing movements. Defaults
to NULL
signature(x = "ContactTrace")
Get the InDegree of a ContactTrace
object.
signature(x = "data.frame")
Get the InDegree for a data.frame with movements, see details and examples.
The time period used for InDegree
can either be specified
using tEnd
and days
or inBegin
and
inEnd
.
If using tEnd
and days
, the time period for ingoing
contacts ends at tEnd
and starts at days
prior to
tEnd
. The indegree will be calculated for each combination
of root
, tEnd
and days
.
An alternative way is to use inBegin
and inEnd
. The
time period for ingoing contacts starts at inBegin and ends at
inEndDate. The vectors root
inBegin
, inEnd
must have the same lengths and the indegree will be calculated for
each index of them.
The movements in InDegree
is a data.frame
with the following columns:
an integer or character identifier of the source holding.
an integer or character identifier of the destination holding.
the Date of the transfer
an optional character vector with the identity of the animal.
an optional numeric vector with the number of animals moved.
an optional character or factor with category of the animal e.g. Cattle.
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
NetworkSummary
if (FALSE) {
## Load data
data(transfers)
## Perform contact tracing using tEnd and days
contactTrace <- Trace(movements = transfers,
root = 2645,
tEnd = "2005-10-31",
days = 91)
## Calculate indegree from a ContactTrace object
id.1 <- InDegree(contactTrace)
## Calculate indegree using tEnd and days
id.2 <- InDegree(transfers,
root = 2645,
tEnd = "2005-10-31",
days = 91)
## Check that the result is identical
identical(id.1, id.2)
## Calculate indegree for all included herds
## First extract all source and destination from the dataset
root <- sort(unique(c(transfers$source,
transfers$destination)))
## Calculate indegree
result <- InDegree(transfers,
root = root,
tEnd = "2005-10-31",
days = 91)
}
Run the code above in your browser using DataLab