ecoensemble
R package for implementing the ensemble framework for combining ecosystem models.
Science Score: 36.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
○.zenodo.json file
-
✓DOI references
Found 1 DOI reference(s) in README -
✓Academic publication links
Links to: wiley.com -
○Academic email domains
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (12.0%) to scientific vocabulary
Repository
R package for implementing the ensemble framework for combining ecosystem models.
Basic Info
- Host: GitHub
- Owner: CefasRepRes
- License: gpl-3.0
- Language: C++
- Default Branch: main
- Size: 90.1 MB
Statistics
- Stars: 1
- Watchers: 2
- Forks: 2
- Open Issues: 0
- Releases: 1
Metadata Files
README.md
EcoEnsemble
EcoEnsemble is an R package to set up, fit and sample from the ensemble framework described in Spence et al (2018) for time series outputs.
Installation
You can install the development version of EcoEnsemble using the devtools package:
r
library(devtools)
install_github("CefasRepRes/EcoEnsemble")
Example
Fitting an ensemble model in EcoEnsemble is done in three main steps:
- Eliciting priors on discrepancy terms: This is done by using the
EnsemblePrior()constructor. - Fitting the ensemble model: Using the
fit_ensemble_model()function with simulator outputs, observations and prior information. The ensemble model can be fit, obtaining either the point estimate, which maximises the posterior density, or running Markov chain Monte Carlo to generate a sample from the posterior denisty of the ensemble model. - Sampling the latent variables from the fitted model: Using the
generate_sample()function with the fitted ensemble object, the discrepancy terms and the ensemble's best guess of the truth can be generated. Similarly tofit_ensemble_model(), this can either be a point estimate or a full sample.
We illustrate this process with datasets included with the package. EcoEnsemble comes loaded with the predicted biomasses of 4 species from 4 different mechanistic models of fish populations in the North Sea. It also includes statistical estimates of the biomasses from single-species stock assessments, and covariances for the model outputs and assessments. The models are run for different time periods and different species.
```{r} library(EcoEnsemble)
Outputs from mizer. These are logs of the biomasses for each year in a simulation.
print(SSB_miz) ```
| |N.pout | Herring |Cod |Sole| |---|--- |--- | --- |--- | |1984| 10.31706 |13.33601 |10.80006 |10.98139| |1985| 12.07673 |13.63592 |10.46646 |10.87285| |...|...|...|...|...| |2049| 12.46354 |14.02923 |12.27473 |10.80954| |2050| 12.46509 |14.03027 |12.27422 |10.81003|
To encode prior beliefs about how model discrepancies are related to one another, use the EnsemblePrior() constructor. Default values are available.
{r}
priors <- EnsemblePrior(4)
or custom priors can be specified.
``` {r}
Endoding prior beliefs. Details of the meanings of these terms can be found in the vignette or the documentation
numspecies <- 4 priors <- EnsemblePrior( d = numspecies, indstparams = IndSTPrior("lkj", list(3, 2), 3, ARparams = c(1,1)), indltparams = IndLTPrior( "beta", list(c(10,4,8, 7),c(2,3,1, 4)), list(matrix(5, numspecies, numspecies), matrix(0.5, numspecies, numspecies)) ), shastparams = ShaSTPrior("invwishart",list(2, 1/3),list(5, diag(numspecies))), shaltparams = 5, truthparams = TruthPrior(numspecies, 10, list(3, 3), list(10, diag(numspecies))) ) ```
This creates an EnsemblePrior object, which we can use to fit the ensemble model using the fit_ensemble_model() function and the data loaded with the package. When running a full MCMC sampling of the posterior, this step may take some time. Samples can then be generated from the resulting object using the generate_sample() function.
{r}
fit <- fit_ensemble_model(observations = list(SSB_obs, Sigma_obs),
simulators = list(list(SSB_ewe, Sigma_ewe, "EwE"),
list(SSB_lm, Sigma_lm, "LeMans"),
list(SSB_miz, Sigma_miz, "mizer"),
list(SSB_fs, Sigma_fs, "FishSUMS")),
priors = priors)
samples <- generate_sample(fit)
This produces an EnsembleSample object containing samples of the ensemble model predictions. These can be viewed by calling the plot() function on this object. For a full MCMC sample, this includes ribbons giving quantiles of the ensemble outputs. If only maximising the posterior density, then only the single ouput is plotted.
{r}
plot(samples)

References
Spence, M. A., J. L. Blanchard, A. G. Rossberg, M. R. Heath, J. J. Heymans, S. Mackinson, N. Serpetti, D. C. Speirs, R. B. Thorpe, and P. G. Blackwell. 2018. “A General Framework for Combining Ecosystem Models.” Fish and Fisheries 19: 1013–42.
Owner
- Name: Centre for Environment Fisheries and Aquaculture Science (Cefas)
- Login: CefasRepRes
- Kind: organization
- Email: github@cefas.co.uk
- Location: UK
- Website: https://www.cefas.co.uk
- Repositories: 42
- Profile: https://github.com/CefasRepRes
Cefas is a world leader in marine science and technology, providing innovative solutions for the aquatic environment, biodiversity and food security
GitHub Events
Total
- Push event: 3
- Pull request event: 3
- Fork event: 1
Last Year
- Push event: 3
- Pull request event: 3
- Fork event: 1
Issues and Pull Requests
Last synced: 10 months ago
All Time
- Total issues: 0
- Total pull requests: 2
- Average time to close issues: N/A
- Average time to close pull requests: about 24 hours
- Total issue authors: 0
- Total pull request authors: 2
- Average comments per issue: 0
- Average comments per pull request: 0.0
- Merged pull requests: 1
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 2
- Average time to close issues: N/A
- Average time to close pull requests: about 24 hours
- Issue authors: 0
- Pull request authors: 2
- Average comments per issue: 0
- Average comments per pull request: 0.0
- Merged pull requests: 1
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
- tb16cefas (3)
- mjthomson (1)
- andrjohns (1)
- olivroy (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- cran 286 last-month
- Total dependent packages: 0
- Total dependent repositories: 0
- Total versions: 8
- Total maintainers: 1
cran.r-project.org: EcoEnsemble
A General Framework for Combining Ecosystem Models
- Homepage: https://github.com/CefasRepRes/EcoEnsemble
- Documentation: http://cran.r-project.org/web/packages/EcoEnsemble/EcoEnsemble.pdf
- License: GPL (≥ 3)
-
Latest release: 1.1.2
published over 1 year ago
Rankings
Maintainers (1)
Dependencies
- R >= 3.5.0 depends
- Rcpp * imports
- RcppParallel >= 5.0.1 imports
- cowplot * imports
- dplyr * imports
- ggplot2 * imports
- matrixcalc * imports
- methods * imports
- reshape2 * imports
- rstan >= 2.18.1 imports
- rstantools >= 2.1.1 imports
- tibble * imports
- knitr * suggests
- mgcv * suggests
- rmarkdown * suggests
- testthat >= 3.0.0 suggests