ssdtools package produces a plot of the cumulative
distributions for multiple distribution through the use of the
ssd_plot_cdf() function. For example, consider the boron
library(ggplot2) library(ssdtools) <- ssd_fit_dists(ssddata::ccme_boron) fits <- ssd_plot_cdf(fits) + scale_color_ssd() gp print(gp)
This graphic is a ggplot object and so can be saved and embellished in the usual way. For example, suppose we want to superimpose an environmental concentration cumulative distribution and compute the exposure risk as outlined in Verdonck et al. (2003).
Finding a suitable probability distribution to describe the exposure concentration is beyond the scope of this document – we will assume that this has been done elsewhere. In particular, suppose that the exposure concentration follows a log-normal distribution with a mean of -2.3 and a standard deviation of 1 on the logarithmic scale. From the exposure distribution, we construct a data frame with the concentration values and the cumulative probability of seeing this exposure or less in the environment.
Notice that some care is needed because the ssdtools plot is on the logarithmic base 10 scale and not the natural logarithm base \(e\) scale.
<- data.frame(Conc = exp(seq(log(.01), log(10), .1))) # generate a grid of concentrations ex.cdf $ex.cdf <- plnorm(ex.cdf$Conc, ex.cdfmeanlog = ex.mean.log, sdlog = ex.sd.log # generate the cdf)
We now add this to the plot
+ gp geom_line(data = ex.cdf, aes(x = Conc, y = ex.cdf), color = "red", linewidth = 2) + annotate("text", label = paste("Exposure distribution"), x = 1.08 * ex.cdf$Conc[which.max(ex.cdf$ex.cdf > 0.5)], y = 0.5, angle = 75 )
ssdtools package contains a function
ssd_exposure() that computes the risk as defined by
Verdonck et al (2003) representing the average proportion of species at
set.seed(99) <- ssd_exposure(fits, meanlog = ex.mean.log, sdlog = ex.sd.log) ex.risk ex.risk
##  0.0062416
The risk of 0.00624 can also be added to the plot in the usual way:
+ gp geom_line(dat = ex.cdf, aes(x = Conc, y = ex.cdf), color = "red", linewidth = 2) + annotate("text", label = paste("Exposure distribution"), x = 1.08 * ex.cdf$Conc[which.max(ex.cdf$ex.cdf > 0.5)], y = 0.5, angle = 75 + ) annotate("text", label = paste("Verdonck risk :", round(ex.risk, 5)), x = Inf, y = 0, hjust = 1.1, vjust = -.5 )
Other embellishments can be added in a similar fashion using the features of ggplot and are not discussed here.
ssdtools by the Province of British Columbia is licensed under a Creative Commons Attribution 4.0 International License.
Verdonck, F. A., Aldenberg, T. , Jaworska, J. and Vanrolleghem, P. A. (2003), Limitations of current risk characterization methods in probabilistic environmental risk assessment. Environmental Toxicology and Chemistry, 22: 2209-2213. https://doi.org/10.1897/02-435