Learn R Programming

tripEstimation (version 0.0-46)

metropolis: Metropolis-Hastings sampler for location estimation for archival and satellite tag

Description

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.

Usage

metropolis(model, iters = 1000, thin = 10, start.x = NULL, start.z = NULL)

metropolis0(model, iters = 1000, thin = 10, start.x = NULL, start.z = NULL)

Value

A MCM Chain stored as a list containing

model

The model object used by the sampler

x

The last iters X-samples accepted, stored as an c(m, n, iters) array

z

The last iters Z-samples accepted, stored as an c(m - 1, 2, iters)

last.x

The last accepted X-sample, stored as a c(m, n) matrix

last.z

The last accepted Z-sample, stored as a c(m, 2) matrix

Arguments

model

model for estimation, such as one created by solar.model

iters

number of iterations to run

thin

number of iterations to thin by

start.x

starting points for the primary locations

start.z

starting points for the intermediate locations (midpoints between the start.x points is a good first guess

Author

Michael D. Sumner and Simon Wotherspoon

Details

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.

References

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

See Also

solar.model, satellite.model