Calculating Optimum Sampling Effort in Community Ecology
Overview
A system for calculating the optimal sampling effort, based on the ideas of "Ecological cost-benefit optimization" as developed by A. Underwood (1997, ISBN 0 521 55696 1). Data is obtained from simulated ecological communities with prep_data() which formats and arranges the initial data, and then the optimization follows the following procedure of four functions: (1) prep_data() takes the original dataset and creates simulated sets that can be used as a basis for estimating statistical power and type II error. (2) sim_beta() is used to estimate the statistical power for the different sampling efforts specified by the user. (3) sim_cbo() calculates then the optimal sampling effort, based on the statistical power and the sampling costs. Additionally, (4) scompvar() calculates the variation components necessary for (5) Underwood_cbo() to calculate the optimal combination of number of sites and samples depending on either an economic budget or on a desired statistical accuracy. Lastly, (6) plot_power() helps the user visualize the results of sim_beta().
Major update
- PERMANOVA refactor: The implementation used by
prep_data()now uses a distance-based MANOVA (dbManova...()) pipeline using Gower-centered distance matrices. This replaces the previous SS calculations based on Huygens' theorem - The new approach is numerically more stable, especially with non-Euclidean distances (e.g., Bray–Curtis), where negative eigenvalues can invalidate naive SS partitions.
- Sums of squares are obtained from projection matrices in the PCoA space (SSCP traces), with correct handling of negative eigenvalues (sign weighting), avoiding drift due to rounding/centering errors.
- Results are therefore more robust and interpretable across a wider range of ecological distances.
Notes on compatibility
The user API of prep_data() remains the same. Small numerical differences may occur due to more correct SS partitioning.
From NEWS.md in the release
Install
Health
- OK13 OK2026-08-05
- NOTE12 OK, 1 NOTE2026-08-01
- OK13 OK2026-06-09
- ERROR12 OK, 1 ERROR2026-06-08
- OK14 OK2026-03-10
Documentation
- Help pages
- 19 (5 internal)includes a package overview page
- Examples that run
- 100%7 run in a plain check
- Exported functions with examples
- 100%
- Documented parameters
- 100%
- Return-value docs
- 100%
- Help pages citing references
- 53%
- ecocbo-guide HTML
Downloads
Repository
- PRs merged (all time)
- 89%
- Median days to close, 50 most recently updated closed issues
- not measured
- Median days to close, 50 most recently updated closed PRs
- 0
Forks over time
PRs over time
8 development-tooling and community-health practices detected across 5 families in the upstream repository
Checks run against github.com/arturosp/ecocbo on 2026-10-11.
The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel
Show all practicesHide 1 practice
Dependencies
Installing ecocbo adds 117 packages (59 with compiled code, 102 MB of source tarballs). Heaviest: stringi 11 MB, ggplot2 6.0 MB, data.table 5.7 MB.
Code & Tests
Datasets
People & History
Pick two releases to compare their code metrics.
- RR 4.6.0 released · 2026-04-24
- 1.0.0Latest
- 0.13.02025-08-23 · diff ↗ ·
removed 7 exports
SS, balanced_sampling, balanced_sampling2, permanova_oneway, permanova_twoway, prep_data_nestedsymmetric, prep_data_singleadded 1 export
Underwood_cbo - RR 4.5.0 released · 2025-04-11
- 0.12.02024-08-21 · diff ↗ ·
added 6 exports
SS, balanced_sampling2, permanova_twoway, prep_data, prep_data_nestedsymmetric, prep_data_single - RR 4.4.0 released · 2024-04-24
- 0.10.22023-08-18
- RR 4.3.0 released · 2023-04-21
Package metadata
- First published
- 2023-08-18
- Total releases
- 4 / 3 yrs
- License
- GPL (>= 3) OSI
- Minimum R
- ≥ 4.1.0
- Bundled data
- 1.6 MB / 7 files
- Download size
- 1.9 MB
Cite
Cite this package
Run in R for the authors' preferred citation:
citation("ecocbo")This package has no citation file, so citation() returns this entry built from DESCRIPTION.
Cite the R Observatory
For a number measured here: a download total, a coverage figure, an archival date.
From data release v2026-10-18, which the citation names so these numbers can be found later. More on citing and the projects behind them.