The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

Frequently Asked Questions

ssdtools Team

2023-09-07

How can I plot the model averaged fit with individual fits?

library(ssddata)
library(ssdtools)
library(ggplot2)

dist <- ssdtools::ssd_fit_dists(ssddata::ccme_boron)
pred <- predict(dist, ci = FALSE)

ssdtools::ssd_plot_cdf(dist) +
  geom_line(data = pred, aes(x = est, y = percent/100))

How do I fit distributions to multiple groups such taxa and/or chemicals?

An elegant approach using some tidyverse packages is demonstrated below.

library(ssddata)
library(ssdtools)
library(ggplot2)
library(dplyr)
library(tidyr)
library(purrr)

boron_preds <- nest(ccme_boron, data = c(Chemical, Species, Conc, Units)) %>%
  mutate(
    Fit = map(data, ssd_fit_dists, dists = "lnorm"),
    Prediction = map(Fit, predict)
  ) %>%
  unnest(Prediction)

The resultant data and predictions can then be plotted as follows.

ssd_plot(ccme_boron, boron_preds, xlab = "Concentration (mg/L)", ci = FALSE) +
  facet_wrap(~Group)


Creative Commons Licence
ssdtools by the Province of British Columbia is licensed under a Creative Commons Attribution 4.0 International License.

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.