Learn R Programming

BayesianAnimalTracker (version 1.2)

as.dataList: Convert the GPS observations and DR path into a data list

Description

The data list prepared by this function will be the input to the BMAnimalTrack function.

Usage

as.dataList(X, Y, Ytime, Xtime=NULL, s2G, timeUnit=1, dUnit=1, dMx=NULL, betaOrder=1, scale=TRUE)

Arguments

X
DR path. The length of it is T.
Y
GPS observations.
Ytime
The time points where the GPS observations are obtained. It has to be a subset of Xtime. See details for more.
Xtime
The time points where the DR path is obtained. When unspecified taken to be 1:T. See details for more.
s2G
The variance of the measurement errors in the GPS observations.
timeUnit
Optional. If provided, the working time points become 1:T/timeUnit, which can be used to stablize the estimates of s2H.
dUnit
Optional. Distance unit. It can be used to scale X, Y.
dMx
The design matrix of the parametric bias $h(t)$ in the DR path.
betaOrder
Only used when dMx is not specified. Decide the degree of the polynomial $h(t) = \sum{q=1}^Q \beta_i t^{q-1}$.
scale
Logical. Whether to scale the design matrix dMx. Recommend to be TRUE.

Value

A list of the following values
XMx
A matrix with T rows. The first column of it is scaled X, second column is 1:T/timeUnit (used in the calculation), and the remaining columns are the scaled design matrix dMx.
glist
A list with of the data on the GPS time points
.

Details

If dMx is not specified. The $h(t)$ is chosen to be polynomial of order betaOrder.

For Xtime and Ytime, they can either be vectors of POSIXlt/POSIXt time points from strptime or character or numeric vectors. But they must be POSIXlt/POSIXt time points when the Xtime are not regularly spaced. See the example in Trip1.

References

Liu, Y., Battaile, B. C., Zidek, J. V., and Trites, A. (2014). Bayesian melding of the Dead-Reckoned path and gps measurements for an accurate and high-resolution path of marine mammals. arXiv preprint arXiv: 1411.6683.

Examples

Run this code
set.seed(1)
#Generating data from our 
dlist <- dataSim(T=100, K=10, s2H=1, s2D=0.1, betaVec=c(1))
gpsObs <- dlist$Y
gpsTime <- dlist$Ytime
drPath <- dlist$X
wlist <- as.dataList(drPath, gpsObs, gpsTime, timeUnit=1, s2G=0.01, dUnit=1, betaOrder=1)
#Example continuous in "BMAnimalTrack".

Run the code above in your browser using DataLab