Learn R Programming

EpiContactTrace (version 0.18.0)

OutDegree: OutDegree

Description

The number of herds with direct movements of animals from the root herd during the defined time window used for tracing

Usage

OutDegree(x, ...)

# S4 method for Contacts OutDegree(x)

# S4 method for ContactTrace OutDegree(x)

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

Value

A data.frame with the following columns:

root

The root of the contact tracing

outBegin

The first date to include outgoing movements

outEnd

The last date to include outgoing movements

outDays

The number of days in the interval outBegin to outEnd

outDegree

The OutDegree of the root within the time-interval

Arguments

x

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

root

vector of roots to calculate outdegree for.

tEnd

the last date to include outgoing movements. Defaults to NULL

days

the number of previous days before tEnd to include outgoing 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 OutDegree of a ContactTrace object.

signature(x = "data.frame")

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

Details

The time period used for OutDegree can either be specified using tEnd and days or outBegin and outEnd.

If using tEnd and days, the time period for outgoing contacts ends at tEnd and starts at days prior to tEnd. The outdegree will be calculated for each combination of root, tEnd and days.

An alternative way is to use outBegin and outEnd. The time period for outgoing contacts starts at outBegin and ends at outEndDate. The vectors root outBegin, outEnd must have the same lengths and the outdegree will be calculated for each index of them.

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

See Also

NetworkSummary

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 outdegree from a ContactTrace object
od.1 <- OutDegree(contactTrace)

## Calculate outdegree using tEnd and days
od.2 <- OutDegree(transfers,
                  root = 2645,
                  tEnd = "2005-10-31",
                  days = 91)

## Check that the result is identical
identical(od.1, od.2)

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

## Calculate outdegree
result <- OutDegree(transfers,
                    root = root,
                    tEnd = "2005-10-31",
                    days = 91)
}

Run the code above in your browser using DataLab