poissonconsulting / ssdtools

An R package to fit and plot species sensitivity distributions.
http://poissonconsulting.github.io/ssdtools/
Apache License 2.0
0 stars 2 forks source link

Add both weighted sample and uniroot bootstrap methods #6

Closed beckyfisher closed 8 months ago

beckyfisher commented 8 months ago

This branch implements both the weighted sample and uniroot methods for estimating hc values, as well as their confidence intervals.

The method used for model average is controlled through a new argument 'averaging_method' can take values of: "arithmetic" - the original arithmetic weighted mean "uniroot" - estimation of the weighted estimate and bootstrap CI's through the uniroot method "weighted_sample" - estimation based on a weighted sample of bootstrap values

A future additions may include the option for taking a geometric weighted mean.

Test the various methods via: data <- ssddata::ccme_boron

colnames(data) <- make.names(colnames(data))

dist <- ssd_fit_dists(data, left = 'Conc', dists = c('gamma', 'lgumbel', 'llogis', 'lnorm', 'weibull'), silent = TRUE, reweight = FALSE, min_pmix = 0, nrow = 6L, computable = TRUE, at_boundary_ok = FALSE, rescale = TRUE) ssd_hc(dist, ci = TRUE, nboot = 100, average = TRUE, averaging_method = "arithmetic")#root = FALSE, ssd_hc(dist, ci = TRUE, nboot = 10, average = TRUE, averaging_method = "uniroot", percent = c(5, 10)) ssd_hc(dist, ci = TRUE, nboot = 100, average = TRUE, averaging_method = "weighted_sample") ssd_hc(dist, ci = FALSE, nboot = 100, average = TRUE, averaging_method = "uniroot", percent = c(5, 10))