Creates randomised movement networks for each network window using datastream permutations with user-defined restrictions (to constrain swaps according to temporal or individual ID-based restrictions)

DatastreamPermSpat(
  data,
  intwindow,
  mindate,
  maxdate,
  netwindow,
  overlap,
  nextonly = FALSE,
  same.time,
  time.restrict,
  spat.restrict,
  same.id,
  n.swaps,
  n.rand,
  burnin,
  n.burnin,
  warn.thresh,
  iter
)

Arguments

data

A 5 column dataframe with columns for the ID of the captured individual, the location of its capture (a name or number), the x coordinate of its capture location, the y coordinate of the capture location, and the date of capture

intwindow

The maximum period of time (in days) between two co-captures (i.e. if intwindow = 10 then two individuals captured 10 days apart could be considered co-captured but two individuals captured 11 days apart couldn't)

mindate

The start date (format = "YYYY-MM-DD") of the study (i.e. when you want to build networks from)

maxdate

The end date (format = "YYYY-MM-DD") of the study (i.e. when you want to build networks until). Please provide as the day after the last day of the study.

netwindow

The period of time over which each network is built in months (i.e. netwindow=12 would correspond to yearly networks)

overlap

The amount of overlap between netwindows in months (i.e. overlap=2 would result in a second network window starting 2 months before the end of the first). When overlap=0, there is no overlap between successive network windows

nextonly

(TRUE/FALSE). Determines whether a network edge is only created to the next capture of an individual or all captures within the intwindow. Defaults to FALSE

same.time

(TRUE/FALSE) Whether swaps should be restricted to only occur trapping events on the same date or not

time.restrict

Provided as a number of months. Imposes time restrictions on when swaps can take place so that locations can only be swapped with those a fixed time before or after being captured

spat.restrict

Provided on the same scale as the coordinates in the input dataset. Imposes space restrictions on when swaps can take place so that locations can only be swapped with those captued within a fixed distance

same.id

(TRUE/FALSE) Whether swaps should be restricted to only be between captures of the same individual

n.swaps

The number of swaps between each random network being extracted (e.g. n.swaps = 10 would equate to 10 swaps taking place between each random network being saved)

n.rand

The number of randomised networks to be generated

burnin

(TRUE/FALSE) Whether burnin is required

n.burnin

The number of swaps to discard as burn-in before the first random network is created. The total number of swaps conducted is thus n.burnin+n.swaps*n.rand

warn.thresh

The number of times no matches are found (i.e. constraints on randomisations are too restrictive) before the function is stopped and an error message returned

iter

(TRUE/FALSE) Whether iterative randomisations are being used. If TRUE then D.rand is also returned

Value

If iter=TRUE then a list of length 3 is returned with elements corresponding to:

  1. The randomised dataset (for feeding back into the next permutation)

  2. Randomised adjacency matrix list: a list of with the same number of elements at the number of network windows, with each element containing an array of the randomised adjacency matrices

  3. a matrix identifying whether a location was present (i.e. had at least one individual captured there) in each network window

If iter=FALSE then a list of length 2 is returned with elements corresponding to:

  1. Randomised adjacency matrix list: a list of with the same number of elements at the number of network windows, with each element containing an array of the randomised adjacency matrices

  2. A matrix identifying whether a location was present (i.e. had at least one individual captured there) in each network window. The edge list is not provided due to to the memory that providing this and the list of matrix arrays would require.

Examples