The user can also specify one or more custom distributions (called say custom
) provided vectorized density (dcustom()
), distribution (pcustom()
), quantile (qcustom()
) and starting value (scustom()
) functions are defined. For example see the llogis source code.
An elegant approach using some tidyverse packages is demonstrated below.
library(purrr)
library(tidyr)
library(dplyr)
boron_preds <- nest(ssdtools::boron_data, 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.