Mechanistic Models for Panel Data: Analysis of Ecological Experiments with Four Interacting Species
Bo Yang, Jesse Wheeler, Meghan A. Duffy, Aaron A. King, Edward L. Ionides
| Preprint: arXiv:2506.04508 | Archive: |
This repository contains the code and data to reproduce all analyses in Mechanistic models for panel data: Analysis of ecological experiments with four interacting species. We develop Panel Iterated Filtering (PIF) and Marginalized PIF (MPIF) methods for maximum likelihood inference on PanelPOMP models, and apply them to mesocosm experiments involving two Daphnia species, an algal food resource (Ankistrodesmus falcatus), and a fungal parasite (Metschnikowia bicuspidata).
| Document | Source | Compiled |
|---|---|---|
| Main manuscript | ms.Rnw |
ms.pdf |
| Supplementary material | si.Rnw |
si.pdf |
The manuscript is self-contained and can be generated by knitting ./daphnia-article/ms.Rnw. The supplement in ./daphnia-article/si/si.Rnw is independent of the main manuscript.
Compile the manuscript:
cd ./daphnia-article && Rscript -e "library(knitr); knit2pdf('./ms.Rnw')"
Compile the supplement:
cd ./daphnia-article/si && Rscript -e "library(knitr); knit2pdf('./si.Rnw')"
Note: The majority of expensive computations are done in separate R scripts, but there are a few calculations (including simulation and pomp object creation) that occur within ms.Rnw.
The file Mesocosmdata.xls contains three sheets:
| Sheet | Contents |
|---|---|
| 1 | D. dentifera dynamics with/without parasite |
| 2 | D. lumholtzi dynamics with/without parasite |
| 3 | Mixed D. dentifera and D. lumholtzi dynamics with/without parasite |
Processed data files used by model fitting scripts are in data/. See Section 2 of the manuscript for the full experimental design (6 treatment conditions × 8–10 replicates, 10 time points over 52 days).
All models are fit under the panelPOMP framework using Panel Iterated Filtering. The run_level parameter in each script controls computational intensity:
| Level | Purpose | Approximate Resources |
|---|---|---|
| 1 | Debug | Minutes, any machine |
| 2 | Local computation | ~1 hour on 36 cores, ~50 GB memory |
| 3 | Full estimation | ~40 hours on 36 cores, ~50 GB memory |
| Model | Treatment | Code | Description |
|---|---|---|---|
| SIRJPF2 | Two species + parasite | Mixed-species/SIRJPF2/ |
Flagship model (8 latent states, 26 parameters) |
| SRJF2 | Two species, no parasite | Mixed-species/SRJF2/ |
Competition through shared food only |
The SIRJPF2 directory contains:
| Subfolder | Contents |
|---|---|
model/ |
Parameter estimation scripts (PIF/MPIF) |
profile/ |
Profile likelihood scripts (MCAP algorithm) |
specific_model/ |
Unit-specific parameter estimation (mif2) |
specific_model_block/ |
Blocked unit-specific estimation (mif2) |
Other model directories follow the same subfolder structure.
| Model | Species | Treatment | Code |
|---|---|---|---|
| SIRJPF | D. dentifera | With parasite | Single-species/Dent/SIRJPF/ |
| SIRJPF | D. lumholtzi | With parasite | Single-species/Lum/SIRJPF/ |
| SRJF | D. dentifera | No parasite | Single-species/Dent/SRJF/ |
| SRJF | D. lumholtzi | No parasite | Single-species/Lum/SRJF/ |
SIRJPF2 (2 species + Parasite + Food + Juveniles) ← Flagship
├── SIRJPF (1 species + Parasite + Food + Juveniles)
├── SRJF2 (2 species + Food + Juveniles, no parasite)
└── SRJF (1 species + Food + Juveniles, no parasite)
The util/ directory contains scripts for generating:
For a step-by-step guide on implementing PanelPOMP models and the methods used in this article, see the companion tutorial:
The tutorial (Supplement 2) covers:
git clone https://github.com/Megumi-ybb/Daphnia-ms.git
cd Daphnia-ms
install.packages(c("pomp", "panelPomp", "tidyverse"))
cd Mixed-species/SIRJPF2/model/
# Set run_level in the script (1 = debug, 2 = local, 3 = full)
Rscript <script_name>.R
cd Mixed-species/SIRJPF2/profile/
Rscript <profile_script>.R
Generate figures and tables using scripts in util/.
If you use this code or data, please cite:
Yang, B., Wheeler, J., Duffy, M. A., King, A. A., & Ionides, E. L. Mechanistic models for panel data: Analysis of ecological experiments with four interacting species. arXiv:2506.04508
BibTeX:
@article{yang2025mechanistic,
title={Mechanistic models for panel data: Analysis of ecological
experiments with four interacting species},
author={Yang, Bo and Wheeler, Jesse and Duffy, Meghan A. and
King, Aaron A. and Ionides, Edward L.},
journal={arXiv preprint arXiv:2506.04508},
year={2025}
}
panelPomp — R package for PanelPOMP models (Bretó et al., 2025)pomp — R package for partially observed Markov processes (King et al., 2016)Archived version available on Zenodo: doi:10.5281/zenodo.15595669