Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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: 8 days ago
JSON representation

An R package to fit and plot Species Sensitivity Distributions (SSDs)

Awesome Lists containing this project

README

        

---
output: github_document
---

```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```

# ssdtools ssdtools logo of cumulative species sensitivity distribution with outlines of commonly used species as data

[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable)
[![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 test coverage](https://codecov.io/gh/bcgov/ssdtools/graph/badge.svg)](https://app.codecov.io/gh/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

### Release

To install the latest release version from [CRAN](https://CRAN.R-project.org/package=ssdtools).
```r
install.packages("ssdtools")
```

#### Website

The website for the release version is at .

### Development

To install the latest development version from [r-universe](https://bcgov.r-universe.dev/ssdtools).
```r
install.packages("ssdtools", repos = c("https://bcgov.r-universe.dev", "https://cloud.r-project.org"))
```

or from [GitHub](https://github.com/bcgov/ssdtools)
```r
# install.packages("pak", repos = sprintf("https://r-lib.github.io/p/pak/stable/%s/%s/%s", .Platform$pkgType, R.Version()$os, R.Version()$arch))
pak::pak("bcgov/ssdtools")
```

#### Website

The website for the development version is at .

## Introduction

The dependency [`ssddata`](https://github.com/open-AIMS/ssddata) provides 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, fig.alt="A plot of the data and fitted distributions"}
autoplot(fits)
```

The goodness of fit can be assessed using `ssd_gof`

```{r}
ssd_gof(fits)
```

and the model-averaged 5% hazard concentration estimated (with bootstrapping to get confidence intervals) using `ssd_hc`.

```{r}
set.seed(99)
hc5 <- ssd_hc(fits, ci = TRUE)
print(hc5)
```

Model-averaged predictions complete with confidence intervals can also be estimated by parametric bootstrapping using the `stats` generic `predict`.

```{r, eval=FALSE}
boron_pred <- predict(fits, ci = TRUE)
```

The predictions can be plotted together with the original data using `ssd_plot`.

```{r, fig.alt="A plot of the data and model-averaged prediction with confidence intervals"}
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()
```

## 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 to the development version see the [NEWS](https://bcgov.github.io/ssdtools/news/) file.

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. .*

### Getting Help or Reporting an Issue

To report bugs/issues/feature requests, please file an [issue](https://github.com/bcgov/ssdtools/issues/).

### Contribution

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.

## References

Posthuma, L., Suter II, G.W., and Traas, T.P. 2001. Species Sensitivity Distributions in Ecotoxicology. CRC Press.

```{r, results = "asis", echo = FALSE}
cat(ssdtools::ssd_licensing_md())
```