‘hmde’ which stands for hierarchical methods for differential equations is a package built for biologists with repeat size measurement data who want to fit a specific set of growth functions.
Installation
‘hmde’ is under active development, you can install the stable, development version of ‘hmde’ from GitHub with:
# install.packages("remotes")
remotes::install_github("traitecoevo/hmde")
Overview
We treat growth as the continuous rate of change for size, and fit size-dependent growth functions. The repeat survey data requires multiple measurements from the same individuals over time that can be connected up as
We assume that different individuals will have variation in the specifics of their growth function governed by the function parameters, but that individuals from the same population will have the same function description.
Notation
For notation we will express the true size for individual
at time
as
,
the growth function as
,
and a parameter of individual
as
.
So Equation can be expressed as
where the integral adds
up all the growth over the intervening time. Each model we use will
comes with its specific growth parameters that we will describe. Some
are more biologically interpretable than others. We don’t assume that we
see the true sizes, and instead have observed size
We have assumed normally distributed error in hmde
,this has
proven reasonably robust in simulation for a more general size-dependent
error model. For details see .
Due to the hierarchical structure of the statistical model, we have distributions that govern the behaviour of growth parameters. If we are modelling only a single individual, we don’t worry about the underlying distribution so much. If we have multiple individuals then we have a distribution with hyper-parameters that acts as a population-level feature, so for example, and we can examine the behaviour of the mean and standard deviation as population-level features.
{hmde} supported growth functions
- Constant growth
- Von Bertalanffy
- Canham
For each growth function, we have implementation to model the growth of a single or for multiple individuals.
Workflow
Broadly, the workflow for hdme
is to:
- Wrangle the data into the required format for a chosen model,
- Pass the data and the model to a function that runs the sampling with Stan’s MCMC algorithms.
- Inspect and anaysis the returned
Stan
fit object.
We will demonstrate this workflow using case studies that uses the
three growth functions that are supported in hmde
. You can
find these on our website or you can view these in R using:
vignettes("constant-growth")
vignettes("von-bertalanffy")
vignettes("canham")
For each case study, we will discuss why that growth function was chosen in the context of the survey process as data availability is a key factor in determining which functions can be used. We will not discuss the mathematical and statistical theory in depth, if that is of interest, check out the vignette ‘hmde for Mathematicians’ or check out the methodology paper: .