Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bcgov/ssdtools
An R package to fit and plot Species Sensitivity Distributions (SSDs)
https://github.com/bcgov/ssdtools
ecotoxicology env rstats species-sensitivity-distribution
Last synced: 3 months ago
JSON representation
An R package to fit and plot Species Sensitivity Distributions (SSDs)
- Host: GitHub
- URL: https://github.com/bcgov/ssdtools
- Owner: bcgov
- License: apache-2.0
- Created: 2017-11-28T22:29:01.000Z (almost 7 years ago)
- Default Branch: main
- Last Pushed: 2024-07-27T00:24:07.000Z (4 months ago)
- Last Synced: 2024-07-27T01:27:33.767Z (4 months ago)
- Topics: ecotoxicology, env, rstats, species-sensitivity-distribution
- Language: R
- Homepage: https://bcgov.github.io/ssdtools/
- Size: 77.7 MB
- Stars: 29
- Watchers: 11
- Forks: 16
- Open Issues: 12
-
Metadata Files:
- Readme: README.Rmd
- Changelog: NEWS.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Support: .github/SUPPORT.md
Awesome Lists containing this project
- jimsghstars - bcgov/ssdtools - An R package to fit and plot Species Sensitivity Distributions (SSDs) (R)
README
---
output: github_document
---```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-"
)
```# ssdtools
[![Lifecycle:Stable](https://img.shields.io/badge/Lifecycle-Stable-97ca00)](https://github.com/bcgov/repomountie/blob/master/doc/lifecycle-badges.md)
[![R-CMD-check](https://github.com/bcgov/ssdtools/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/bcgov/ssdtools/actions/workflows/R-CMD-check.yaml)
[![codecov](https://codecov.io/github/bcgov/ssdtools/graph/badge.svg?token=gVKHQQD1Jp)](https://codecov.io/github/bcgov/ssdtools)
[![CRAN status](https://www.r-pkg.org/badges/version/ssdtools)](https://cran.r-project.org/package=ssdtools)
![CRAN downloads](https://cranlogs.r-pkg.org/badges/ssdtools)`ssdtools` is an R package to fit and plot Species Sensitivity Distributions (SSD).
SSDs are cumulative probability distributions which are fitted to toxicity concentrations for different species as described by Posthuma et al. (2001).
The ssdtools package uses Maximum Likelihood to fit distributions such as the log-normal, log-logistic, log-Gumbel (also known as the inverse Weibull), gamma, Weibull and log-normal log-normal mixture.
Multiple distributions can be averaged using Akaike Information Criteria.
Confidence intervals on hazard concentrations and proportions are produced by bootstrapping.## Installation
To install the latest version from [CRAN](https://CRAN.R-project.org/package=ssdtools)
```{r, eval = FALSE}
install.packages("ssdtools")
```To install the latest development version from [GitHub](https://github.com/bcgov/ssdtools)
```{r, eval = FALSE}
# install.packages("remotes")
remotes::install_github("bcgov/ssdtools")
```## Introduction
The dependency [`ssddata`](https://cran.r-project.org/web/packages/ssddata/index.html) provides a example data sets for several chemicals including Boron.
```{r, message=FALSE}
library(ssdtools)
ssddata::ccme_boron
```The six default distributions are fit using `ssd_fit_dists()`
```{r}
fits <- ssd_fit_dists(ssddata::ccme_boron)
```and can be quickly plotted using `autoplot`
```{r, warning = FALSE, message = FALSE}
autoplot(fits)
```The goodness of fit can be assessed using `ssd_gof`
```{r}
ssd_gof(fits)
```and the model-averaged 5% hazard concentration estimated by bootstrapping using `ssd_hc`.
```{r}
set.seed(99)
hc5 <- ssd_hc(fits, ci = TRUE)
print(hc5)
```To bootstrap in parallel set `future::plan()`. For example:
```{r, eval=FALSE}
future::multisession(workers = 2)
hc5 <- ssd_hc(fits, ci = TRUE)
```Model-averaged predictions complete with confidence intervals can also be estimated by parametric bootstrapping using the `stats` generic `predict`.
To perform bootstrapping for each distribution in parallel register the future backend
and then select the evaluation strategy.
```{r, eval=FALSE}
doFuture::registerDoFuture()
future::plan(future::multisession)set.seed(99)
boron_pred <- predict(fits, ci = TRUE)
```The predictions can be plotted together with the original data using `ssd_plot`.
```{r}
library(ggplot2)theme_set(theme_bw())
ssd_plot(ssddata::ccme_boron, boron_pred,
shape = "Group", color = "Group", label = "Species",
xlab = "Concentration (mg/L)", ribbon = TRUE
) +
expand_limits(x = 3000) +
scale_colour_ssd()
```## References
Posthuma, L., Suter II, G.W., and Traas, T.P. 2001. Species Sensitivity Distributions in Ecotoxicology. CRC Press.
## Information
Get started with ssdtools at .
A shiny app to allow non-R users to interface with ssdtools is available at .
For the latest changes visit [NEWS](https://bcgov.github.io/ssdtools/news).
The citation for the shiny app:
*Dalgarno, S. 2021. shinyssdtools: A web application for fitting Species Sensitivity Distributions (SSDs). JOSS 6(57): 2848. https://joss.theoj.org/papers/10.21105/joss.02848.*
The ssdtools package was developed as a result of earlier drafts of:
*Schwarz, C., and Tillmanns, A. 2019. Improving Statistical Methods for Modeling Species Sensitivity Distributions. Province of British Columbia, Victoria, BC.*
For recent developments in SSD modeling including a review of existing software see:
*Fox, D.R., et al. 2021. Recent Developments in Species Sensitivity Distribution Modeling. Environ Toxicol Chem 40(2): 293–308. .*
The CCME `data.csv` data file is derived from a factsheet prepared by the [Canadian Council of Ministers of the Environment](http://ceqg-rcqe.ccme.ca/en/index.html).
See the [`data-raw`](https://github.com/bcgov/ssdtools/tree/master/data-raw) folder for more information.## Getting Help or Reporting an Issue
To report bugs/issues/feature requests, please file an [issue](https://github.com/bcgov/ssdtools/issues/).
## How to Contribute
If you would like to contribute to the package, please see our
[CONTRIBUTING](https://github.com/bcgov/ssdtools/blob/master/.github/CONTRIBUTING.md) guidelines.## Code of Conduct
Please note that the ssdtools project is released with a [Contributor Code of Conduct](https://contributor-covenant.org/version/2/1/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.
```{r, results = "asis", echo = FALSE}
cat(ssd_licensing_md())
```