Learn R Programming

EpiContactTrace (version 0.18.0)

NetworkSummary: NetworkSummary

Description

NetworkSummary gives a summary of the contact tracing including the time-window, InDegree, OutDegree, IngoingContactChain and OutgoingContactChain.

Usage

NetworkSummary(x, ...)

# S4 method for ContactTrace NetworkSummary(x)

# S4 method for list NetworkSummary(x)

# S4 method for data.frame NetworkSummary( x, root, tEnd = NULL, days = NULL, inBegin = NULL, inEnd = NULL, outBegin = NULL, outEnd = NULL )

Value

A data.frame with the following columns:

root

The root of the contact tracing

inBegin

Equals inBegin in Trace

inEnd

Equals inEnd in Trace

outBegin

Equals outBegin in Trace

outEnd

Equals outEnd in Trace

inDegree

The InDegree of the contact tracing

outDegree

The OutDegree of the contact tracing

ingoingContactChain

The IngoingContactChain of the contact tracing

outgoingContactChain

The OutgoingContactChain of the contact tracing

Arguments

x

a ContactTrace object, a data.frame with movements of animals between holdings (see Trace for details), or a list of ContactTrace objects where each item in the list must be a ContactTrace object.

...

Additional arguments to the method

root

vector of roots to calculate network summary for.

tEnd

the last date to include ingoing movements. Defaults to NULL

days

the number of previous days before tEnd to include ingoing movements. Defaults to NULL

inBegin

the first date to include ingoing movements. Defaults to NULL

inEnd

the last date to include ingoing movements. Defaults to NULL

outBegin

the first date to include outgoing movements. Defaults to NULL

outEnd

the last date to include outgoing movements. Defaults to NULL

Methods

signature(x = "ContactTrace")

Get the network summary for the ingoing and outgoing Contacts of a ContactTrace object.

signature(x = "list")

Get the network summary for a list of ContactTrace objects. Each item in the list must be a ContactTrace object.

signature(x = "data.frame")

Get the network summary for a data.frame with movements, see details and examples.

Details

The time period used for NetworkSummary 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 network summary will be calculated 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 network summary will be calculated for each index of them.

The movements in NetworkSummary 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

Run this code
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 network summary from a ContactTrace object
ns_1 <- NetworkSummary(contactTrace)

## Calculate network summary using tEnd and days
ns_2 <- NetworkSummary(transfers,
                       root = 2645,
                       tEnd = "2005-10-31",
                       days = 91)

## Check that the result is identical
identical(ns_1, ns_2)

## Calculate network summary using inBegin, inEnd
## outBegin and outEnd
ns_3 <- NetworkSummary(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(ns_2, ns_3)

## When calculating the network summary for a data.frame of movements
## a data.frame for each combination of root, tEnd and days are returned.
root <- c(1, 2, 3)
tEnd <- c("2005-09-01", "2005-10-01")
days <- c(30, 45)

## The network summary are calculated at the following
## 12 combinations.
## root = 1, tEnd = "2005-09-01", days = 30
## root = 1, tEnd = "2005-09-01", days = 45
## root = 1, tEnd = "2005-10-01", days = 30
## root = 1, tEnd = "2005-10-01", days = 45
## root = 2, tEnd = "2005-09-01", days = 30
## root = 2, tEnd = "2005-09-01", days = 45
## root = 2, tEnd = "2005-10-01", days = 30
## root = 2, tEnd = "2005-10-01", days = 45
## root = 3, tEnd = "2005-09-01", days = 30
## root = 3, tEnd = "2005-09-01", days = 45
## root = 3, tEnd = "2005-10-01", days = 30
## root = 3, tEnd = "2005-10-01", days = 45
NetworkSummary(transfers, root, tEnd, days)

## Create a network summary for all included herds
## First extract all source and destination from the dataset
root <- sort(unique(c(transfers$source,
                      transfers$destination)))

## Perform contact tracing using tEnd and days
result_1 <- NetworkSummary(transfers,
                           root = root,
                           tEnd = "2005-10-31",
                           days = 90)

## Perform contact tracing using inBegin, inEnd, outBegin and outEnd.
result_2 <- NetworkSummary(transfers,
                           root = root,
                           inBegin = rep("2005-08-02", length(root)),
                           inEnd = rep("2005-10-31", length(root)),
                           outBegin = rep("2005-08-02", length(root)),
                           outEnd = rep("2005-10-31", length(root)))
}

Run the code above in your browser using DataLab