Skip to content

pboesu/moultmcmc

Repository files navigation

moultmcmc: Bayesian inference for moult phenology models

Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public. R-CMD-check codecov CRAN_Status_Badge moultmcmc status badge

Introduction

In most free-living animal populations moult progression and duration in individuals can not be observed fully. Instead snapshot measurements of (re)captured individuals are typically used to infer these parameters on a population level. As an additional complication, recording of moult in the field may take various forms both in terms of the subset of the population that is sampled and whether moult is recorded as a categorical state, or a (semi-)continuous progression.

Underhill & Zucchini (1989; Ibis 130:358) proposed a general modelling framework to accommodate many of these features, implemented in the R package moult (Erni et al. 2013; J Stat Soft 52:8).

moultmcmc implements a Bayesian inference framework for this class of models with the aim of (eventually) allowing the inclusion of hierarchical model structures to accommodate

  1. the integration of moult data sets using different modes of recording (☑),
  2. individual heterogeneity in moult timing (☑) and progression (☐), and
  3. misclassified observations of non-moulting birds (☑)

moultmcmc implements fast inference for these models using Hamiltonian Monte Carlo samplers from Stan. The currently implemented models are described in detail in Boersch-Supan et al. 2022 and the vignette 'Moult data likelihoods'.

Installation

The package moultmcmc is built around pre-compiled Stan models, the easiest and quickest way of installing it is to install the package from R-universe use the following code:

install.packages("moultmcmc", repos = "https://pboesu.r-universe.dev")

On Mac and Windows systems this will make use of pre-compiled binaries, which means the models can be run without having to install a C++ compiler. A Linux binary is available for r-release on ubuntu:latest and repository settings to obtain this are explained in the r-universe help. For all other Linux platforms the above code will install the package from a source tarball. Because of the way the Stan models are currently structured, compilation from source can be a lengthy process (15-45 minutes), depending on system setup and compiler toolchain.

To install moultmcmc from the github source (not generally recommended for MacOS or Windows users) use the following code. This requires a working C++ compiler and a working installation of rstan:

#not generally recommended for Windows/MacOS users
install.packages("remotes")
remotes::install_github("pboesu/moultmcmc")

Usage

Basic usage is described in the vignette 'Getting started with moultmcmc'
Please note that moultmcmc is under active development and API changes may still occur.