Generate new tracks from a Crawl model
surrogateCrawl( model, xs, ts = 1:nrow(xs), fixed = rep(c(TRUE, FALSE, TRUE), c(1, nrow(xs) - 2, 1)), point.check = function(tm, pt) TRUE, Verr = diag(c(1e-04, 1e-04, 0.1, 0.1)), partial = FALSE )
model | a list with the transition and covariance matrices corresponding to the fitted movement model. |
---|---|
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. |
Verr | error covariance for fixed points. |
partial | if |
An array of states the define the simulated path.
Given a fitted crawl 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 states where each row is a state and each column a
state variable. The states must be equispaced in time, and can be
generated as the "p" location types from crwPredict
.
The crawl model object is generated by crawlModel
from a
fitted crawl model.
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.