These functions provide a direct implementation of the Metropolis-Hastings algorithm, for calculating marginal posterior (locations and full-track estimates) properties using Markov Chain Monte Carlo. The sampler is written completely in R, vectorized to be as fast as possible. The sampler can include likelihood functions for large data records (including light and water temperature), as well as mask functions for simpler rejection sources. Behavioural constraints are implemented using a red/black update, so that location estimates X and Z may be estimated in an efficient manner. The parameter estimates may be cached and later queried arbitrarily.
metropolis(model, iters = 1000, thin = 10, start.x = NULL, start.z = NULL)metropolis0(model, iters = 1000, thin = 10, start.x = NULL, start.z =
NULL)
A MCM Chain stored as a list containing
The model object used by the sampler
The last iters
X-samples accepted, stored as an c(m, n, iters)
array
The last iters
Z-samples accepted, stored as an c(m - 1, 2, iters)
The last accepted X-sample, stored as a c(m, n)
matrix
The last accepted Z-sample, stored as a c(m, 2)
matrix
model for estimation, such as one created by solar.model
number of iterations to run
number of iterations to thin by
starting points for the primary locations
starting points for the intermediate locations
(midpoints between the start.x
points is a good first guess
Michael D. Sumner and Simon Wotherspoon
metropolis0
is a slightly different version of metropolis
that enables an initialization step, required to find parameter estimates that are
consistent with any masks used. It is difficult to make this step more elegant, and so
we live with the two versions.
In terms of the estimates, X's have m
records with n
parameters, where m
is the number of data records in time (twilights for archival tags, Argos estimates for satellite
tags) and n
is at least x-coordinate, y-coordinate and maybe k-attenuation for light.
Z's have m-1
records with 2 parameters for `x` and `y` (which are usually Longitude and
Latitude). These parameters may be increased or changed, they are tied only to the likelihood
functions used, not the sampler itself. Also, coordinate transformations may be used inside the model
and likelihood functions, in order to use an appropriate map projection. Solar calculations rely on
lon/lat and so this step does slow down light level geo-location.
Sumner, Wotherspoon and Hindell (2009). Bayesian Estimation of Animal Movement from Archival and Satellite Tags, PLoS ONE. https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0007324
solar.model
, satellite.model