rwalcSimulate: RWalc track sampler

View source: R/RWalc.R

rwalcSimulateR Documentation

RWalc track sampler

Description

Simulate a new track from the parameters of a fitted 'rwalc' model.

Usage

rwalcSimulate(
  data,
  par,
  fixed = NULL,
  fixed.err = diag(1e-06, 4, 4),
  point.check = function(tm, x, y) TRUE,
  point.accept = NULL
)

Arguments

data

A dataframe representing the template track.

par

The model parameters.

fixed

An integer vector indicating which locations in the template path are to be held fixed.

fixed.err

Covariance matrix for fixed points.

point.check

A function that accepts a time, and an x,y location and returns a logical indicating whether the location is acceptable.

point.accept

A logical vector indicating which locations should not be checked with the 'point.check' function. Defaults to the value of 'fixed'.

Details

Given a template track and the parameters of a rwalc model this function generates a new track of the same length that coincides with the fitted track at the start point and optionally other specified points along the template track.

Locations from the template track can be marked as fixed with the 'fixed' argument. This should either be 'NULL' or a vector with an entry for each location, with entries indicating:

- 0: the location is not fixed - 1: the location is fixed - 2: the location is fixed and the point may be a cusp (autocorrelation is reset).

In the current implementation the first location in each segment must be fixed. The 'fixed.err' parameter specifies the covariance of the error in the fixed points, allowing the user to control how acccurately the simulated track reproduces the four components (locations and velocities) of the fixed points.

Additional constraints can be placed on the path by rejection sampling through the function 'point.check'. This function must accept a time, x and y and return a logical 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 locations on land.

The 'point.accept' can be used to mark points that should not be checked in the rejection step. Currently this defaults to the value of 'fixed' - so by default fixed points are never checked.

Tracks are simulated in the plane. There is is no polar correction and without a suitable 'point.check' function, there is nothing prevent the track extending outside the \[-90,90\] latitudinal limits.

Value

Returns a dataframe representing the simulated track with columns: - 'segment': track segment - 'date': time (as GMT POSIXct) - 'x': x coordinate - 'y': y coordinate - 'x.v': x component of velocity - 'y.v': y component of velocity


SWotherspoon/RWalc documentation built on June 10, 2025, 6:46 a.m.