-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathREADME.Rmd
163 lines (117 loc) · 6.07 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r setup, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-"
)
```
# ssdtools <img src="man/figures/logo.png" align="right" />
<!-- badges: start -->
[](https://github.com/bcgov/repomountie/blob/master/doc/lifecycle-badges.md)
[](https://github.com/bcgov/ssdtools/actions)
[](https://codecov.io/github/bcgov/ssdtools?branch=master)
[](https://cran.r-project.org/package=ssdtools)

[](https://doi.org/10.21105/joss.01082)
<!-- badges: end -->
`ssdtools` is an R package to plot and fit 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, gamma, log-logistic, log-Gumbel, Gompertz and Weibull.
The user can also provide custom distributions.
Multiple distributions can be averaged using Information Criteria.
Confidence intervals on hazard concentrations and proportions are produced by parametric 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:
```{r, eval = FALSE}
install.packages("remotes")
remotes::install_github("bcgov/ssdtools")
```
## Introduction
`ssdtools` provides a data set for several chemicals including Boron.
```{r, message=FALSE}
library(ssdtools)
boron_data
```
Multiple distributions can be fit using `ssd_fit_dists()`
```{r, eval = FALSE}
boron_dists <- ssd_fit_dists(boron_data)
```
and plot using the `ggplot2` generic `autoplot`
```{r, warning = FALSE}
library(ggplot2)
theme_set(theme_bw())
autoplot(boron_dists)
```
The goodness of fit can be assessed using `ssd_gof`
```{r, warning = FALSE}
ssd_gof(boron_dists)
```
and the model-averaged 5% hazard concentration estimated using `ssd_hc`
```{r, eval = FALSE}
set.seed(99)
boron_hc5 <- ssd_hc(boron_dists, ci = TRUE)
```
```{r}
print(boron_hc5)
```
Model-averaged predictions complete with confidence intervals can be produced using the `stats` generic `predict`
```{r, eval=FALSE}
set.seed(99)
boron_pred <- predict(boron_dists, ci = TRUE)
```
and plotted together with the original data using `ssd_plot`.
```{r}
ssd_plot(boron_data, boron_pred,
shape = "Group", color = "Group", label = "Species",
xlab = "Concentration (mg/L)", ribbon = TRUE
) + expand_limits(x = 3000)
```
## Citation
```{r, comment = "", echo = FALSE}
citation(package = "ssdtools")
```
## Information
Posthuma, L., Suter II, G.W., and Traas, T.P. 2001. Species Sensitivity Distributions in Ecotoxicology. CRC Press.
Get started with ssdtools at <https://bcgov.github.io/ssdtools/articles/ssdtools.html>.
A shiny app to allow non-R users to interface with ssdtools is available at <https://github.com/bcgov/shinyssdtools>:
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:
Fox, D.R., et al. 2021. Recent Developments in Species Sensitivity Distribution Modeling. Environ Toxicol Chem 40(2): 293–308. <https://onlinelibrary.wiley.com/doi/10.1002/etc.4925>.
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/0/CODE_OF_CONDUCT.html).
By contributing to this project, you agree to abide by its terms.
## License
The code is released under the Apache License 2.0
Copyright 2015 Province of British Columbia
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-----
<a rel="license" href="https://creativecommons.org/licenses/by/4.0/"><img alt="Creative Commons Licence"
style="border-width:0" src="https://i.creativecommons.org/l/by/4.0/80x15.png" /></a><br /><span
xmlns:dct="http://purl.org/dc/terms/" property="dct:title">ssdtools</span> by <span
xmlns:cc="http://creativecommons.org/ns#" property="cc:attributionName">the Province of British Columbia
</span> is licensed under a <a rel="license" href="https://creativecommons.org/licenses/by/4.0/">
Creative Commons Attribution 4.0 International License</a>.