IngoingContactChain {EpiContactTrace}R Documentation

IngoingContactChain

Description

The ingoing contact chain is the number of holdings in the network of direct and indirect contacts to the root holding, with regard to temporal and order of the contacts during the defined time window used for contact tracing.

Usage

IngoingContactChain(x, ...)

## S4 method for signature 'Contacts'
IngoingContactChain(x)

## S4 method for signature 'ContactTrace'
IngoingContactChain(x)

## S4 method for signature 'data.frame'
IngoingContactChain(
  x,
  root,
  tEnd = NULL,
  days = NULL,
  inBegin = NULL,
  inEnd = NULL
)

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 ingoing contact chain 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

Details

The time period used for IngoingContactChain 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 IngoingContactChain 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.

Value

A data.frame with the following columns:

root

The root of the contact tracing

inBegin

The first date to include ingoing movements

inEnd

The last date to include ingoing movements

inDays

The number of days in the interval inBegin to inEnd

ingoingContactChain

The IngoingContactChain of the root within the time-interval

Methods

signature(x = "ContactTrace")

Get the IngoingContactChain of a ContactTrace object.

signature(x = "data.frame")

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

References

See Also

NetworkSummary

Examples

## Not run: 

## Load data
data(transfers)

## Perform contact tracing using tEnd and days
contactTrace <- Trace(movements = transfers,
                      root = 2645,
                      tEnd = "2005-10-31",
                      days = 91)

## Calculate ingoing contact chain from a ContactTrace object
ic.1 <- IngoingContactChain(contactTrace)

## Calculate ingoing contact chain using tEnd and days
ic.2 <- IngoingContactChain(transfers,
                            root = 2645,
                            tEnd = "2005-10-31",
                            days = 91)

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

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

## Calculate ingoing contact chain
result <- IngoingContactChain(transfers,
                              root = root,
                              tEnd = "2005-10-31",
                              days = 91)

## End(Not run)

[Package EpiContactTrace version 0.17.0 Index]