knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  message = FALSE
)

mpmm - fit movement persistence mixed-effects models to animal tracking data

Lifecycle: experimental

master branch:
R-CMD-check

dev branch:
R-CMD-check

mpmm is an R package that fits movement persistence mixed-effect models to animal tracking data for inference of linear relationships with covariates, accounting for individual variability (Jonsen et al. 2019. Ecology 100:e02566). Random effects are assumed to be approximately normal. It is assumed that the location data are either relatively error-free (e.g., GPS locations) or filtered estimates from a state-space model fitted to error-prone data (e.g., Argos locations). Models are specified using standard mixed-model formulas, as you would in lme4 or glmmTMB. The movement persistence model can be fit as either a discrete-time (Jonsen et al. 2019) or a continuous-time (Auger-Méthé et al. 2017. MEPS 565:237-249) process. The underlying code for specifying and estimating fixed and random effects borrows heavily on glmmTMB code, but is implemented in a more limited manner in mpmm. Currently, only diagonal or unstructured covariances are possible; interaction terms are not possible; the grouping term for the random effects is always assumed to be the individual animal id (or individual sub-tracks tid).

Installation

First, ensure you have R version >= 3.6.0 installed (preferably R 4.0.0 or higher):

R.Version()

From GitHub (source)

On PC's running Windows, ensure you have installed Rtools

On Mac's, ensure you have installed the Command Line Tools for Xcode by executing xcode-select --install in the terminal; or you can download the latest version from the URL (free developer registration may be required). A full Xcode install uses up a lot of disk space and is not required.

Currently, mpmm can only be installed from GitHub:

remotes::install_github("ianjonsen/mpmm")

Note: there can be issues getting compilers to work properly, especially on a Mac with OS X 10.13.x or higher. If you encounter install and compile issues, I recommend you consult the excellent information on the glmmTMB GitHub.

Basic example

mpmm fits mixed models and facilitates model selection, validation and visualisation of estimated covariate relationships:

library(mpmm)

fit <-
  mpmm(
    ~ ice + sal_diff + (ice |
               id),
    data = ellie.ice,
    control = mpmm_control(
      REML = TRUE, 
      verbose = 0 # turn off parameter trace for tidy output
    )
  ) 

summary(fit)

plot(fit)


ianjonsen/mpmm documentation built on July 6, 2024, 7:53 a.m.