Simulate track from fitted vector autoregressive model
Usage
surrogate_arsimulate(
arfit,
n,
startlonlat,
fixed = NULL,
endlonlat = NULL,
do.test.land = TRUE,
random.rotation = c(-pi, pi),
verbose = 0,
return.all.points = FALSE,
intermediate.tries = 10,
original = FALSE
)
surrogate_arsimulate0(
arfit,
n,
startlonlat,
fixed = NULL,
endlonlat = NULL,
do.test.land = TRUE,
random.rotation = c(-pi, pi),
verbose = 0,
return.all.points = FALSE,
intermediate.tries = 10
)Arguments
- arfit
fitted object of class "ar" as returned by
surrogate_arfit- n
number of points to simulate
- startlonlat
2-element vector of starting longitude and latitude
- fixed
a dataframe or matrix in which the first column is the index (from 1:n) of each fixed point, and the second and third columns give the associated longitude and latitude
- endlonlat
a 2-element vector with ending longitude and latitude. If NULL, no end constraint is imposed except for land masking (if land masking is used). This is a simple way of imposing a return-to-starting-location constraint; for more complex constraints use the
fixedargument- do.test.land
a logical or function. If TRUE, use the included land mask to avoid land. Alternatively, a function can be passed that returns TRUE (point is okay, not on land) or FALSE (point is on land) for a given lon,lat. Note that land masking is ignored for fixed points. Note also that it is possible to create a sitation where tracks are difficult or impossible to simulate, because a fixed point is sufficiently far onto land that the track cannot reach it.
- random.rotation
a 2-element vector giving the range of the rotation to apply to the randomized track (values in radians). use
random.rotation=NULLfor no such rotation. The angle can be restricted usingrandom.rotation=c(min.angle,max.angle)- this may speed up computation by avoiding impossible angles (e.g. tracks over a land mass)- verbose
an integer 0-3, if >0 spit out extra information which may be helpful if things don't work as expected. Larger numbers mean more output
- return.all.points
if TRUE, return points that were proposed but rejected due to land masking (may be helpful for debugging). If TRUE, the returned data.frame will have an extra column named "valid"
- intermediate.tries
when land-masking, try how many times to find a valid point at each step before giving up and starting again? Higher values may improve overall run-time, but too-high values may yield tracks that aren't a good representation of the fitted model
- original
if
TRUE, use the original algorithm.