Simulate track from fitted vector autoregressive model
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 )
arfit | fitted object of class "ar" as returned by
|
---|---|
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 |
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 |
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 |
2 or 3 column dataframe with the longitude and latitude of simulated track points (and point validity, if return.all.points is TRUE)
Note that land masking uses a built-in land mask image, and it only covers the southern hemisphere. A future version will do something about this.