The goal of hmde is to fit a model for the rate of change in some quantity based on a set of pre-defined functions arising from ecological applications. We estimate differential equation parameters from repeated observations of a process, such as growth rate parameters to data of sizes over time.
In other language, hmde
implements hierarchical Bayesian longitudinal models to solve the Bayesian inverse problem of estimating differential equation parameters based on repeat measurement surveys. Estimation is done using Markov Chain Monte Carlo, implemented through
Stan via RStan, built under R 4.3.3. The inbuilt models are based on case studies in ecology.
The general use case is to estimate a vector of parameters
The input data are observations of the form
Rmot comes with four DEs built and ready to go, each of which has a version for a single individual and multiple individuals.
The constant model is given by
The power law model is given by
The von Bertalanffy mode is given by
The Canham (Canham et
al. 2004)
model is a hump-shaped function given by
‘hmde’ is under active development. You can install the current developmental version of ‘hmde’ from GitHub with:
# install.packages("remotes")
remotes::install_github("traitecoevo/hmde")
Create constant growth data with measurement error:
y_obs <- seq(from=2, to=15, length.out=10) + rnorm(10, 0, 0.1)
Measurement error is necessary as otherwise the normal likelihood
Fit the model:
constant_fit <- hmde_model("constant_single_ind") |>
hmde_assign_data(n_obs = 10, #Integer
y_obs = y_obs, #vector length n_obs
obs_index = 1:10, #vector length n_obs
time = 0:9, #Vector length n_obs
y_0_obs = y_obs[1] #Real
) |>
hmde_run(chains = 1, iter = 1000, verbose = FALSE, show_messages = FALSE)
Please submit a GitHub issue with details of the bug. A reprex would be particularly helpful with the bug-proofing process!