Generate new tracks from a VAR(1)

surrogateAR(
  model,
  xs,
  ts = 1:nrow(xs),
  fixed = rep(c(TRUE, FALSE, TRUE), c(1, nrow(xs) - 2, 1)),
  point.check = function(tm, pt) TRUE,
  random.rotation = c(-pi, pi),
  partial = FALSE
)

Arguments

model

a model generated with surrogateARModel.

xs

the template sequence of states

ts

the times at which the track is sampled

fixed

a logical vector indicating which locations in the template path are to be held fixed.

point.check

function that accepts a state and returns boolean indicating whether the state is acceptable.

random.rotation

the upper and lower limits (radians) of the rotation applied to the VAR(1) model.

partial

if TRUE, a partial track is returned if the sampling fails.

Value

An array of states the define the simulated path.

Details

Given a fitted VAR(1) model and a template track, this function generates a new track of the same length that coincides with the template at the start point and optionally other specified points along the track.

The template track must be supplied as a matrix representing a sequence of locations where each row is a location and the columns represent longitude and latitude. The locations must be equispaced in time, and can be generated as the "p" location types from crwPredict.

The model object is generated by surrogateARModel from a fitted crawl track. This fits a VAR(1) model to the increments in longitude and latitude.

Locations from the template track can be marked as fixed with the fixed argument. In the current implementation the first location must always be fixed.

Additional constraints can be placed on the path by rejection sampling through the function point.check. This function must accept a state and return a boolean indicating whether the point is acceptable. For example, the track can be constrained to the ocean by supplying a point.check function that compares the state to a land mask and returns FALSE for states corresponding to locations that fall on land.