R Under development (unstable) (2025-06-30 r88369 ucrt) -- "Unsuffered Consequences" Copyright (C) 2025 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > require("fitdistrplus") Loading required package: fitdistrplus Loading required package: MASS Loading required package: survival > nbboot <- 1001 > nbboot <- 10 > > > # (1) Fit of a normal distribution on acute toxicity log-transformed values of endosulfan for > # nonarthropod invertebrates, using maximum likelihood estimation > # to estimate what is called a species sensitivity distribution > # (SSD) in ecotoxicology, followed by estimation of the 5, 10 and 20 percent quantile values of > # the fitted distribution, which are called the 5, 10, 20 percent hazardous concentrations (HC5, HC10, HC20) > # in ecotoxicology, followed with calculations of their confidence intervals with various definitions. > # > data(endosulfan) > ATV <- subset(endosulfan, group == "NonArthroInvert")$ATV > log10ATV <- log10(subset(endosulfan, group == "NonArthroInvert")$ATV) > fln <- fitdist(log10ATV, "norm") > quantile(fln, probs = c(0.05, 0.1, 0.2)) Estimated quantiles for each specified probability (non-censored data) p=0.05 p=0.1 p=0.2 estimate 1.744227 2.080093 2.4868 > bln <- bootdist(fln, niter=nbboot, bootmethod="param") > quantile(bln, probs = c(0.05, 0.1, 0.2)) (original) estimated quantiles for each specified probability (non-censored data) p=0.05 p=0.1 p=0.2 estimate 1.744227 2.080093 2.4868 Median of bootstrap estimates p=0.05 p=0.1 p=0.2 estimate 1.783121 2.108674 2.461769 two-sided 95 % CI of each quantile p=0.05 p=0.1 p=0.2 2.5 % 1.465130 1.788730 2.180584 97.5 % 2.187916 2.446209 2.783359 > quantile(bln, probs = c(0.05, 0.1, 0.2), CI.type = "greater") (original) estimated quantiles for each specified probability (non-censored data) p=0.05 p=0.1 p=0.2 estimate 1.744227 2.080093 2.4868 Median of bootstrap estimates p=0.05 p=0.1 p=0.2 estimate 1.783121 2.108674 2.461769 left bound of one-sided 95 % CI of each quantile p=0.05 p=0.1 p=0.2 5 % 1.474216 1.795825 2.185267 > quantile(bln, probs = c(0.05, 0.1, 0.2), CI.level = 0.9) (original) estimated quantiles for each specified probability (non-censored data) p=0.05 p=0.1 p=0.2 estimate 1.744227 2.080093 2.4868 Median of bootstrap estimates p=0.05 p=0.1 p=0.2 estimate 1.783121 2.108674 2.461769 two-sided 90 % CI of each quantile p=0.05 p=0.1 p=0.2 5 % 1.474216 1.795825 2.185267 95 % 2.176768 2.428091 2.781179 > > # (2) Fit of a distribution on acute salinity log-transformed tolerance > # for riverine macro-invertebrates, using maximum likelihood estimation > # to estimate what is called a species sensitivity distribution > # (SSD) in ecotoxicology, followed by estimation of the 5, 10 and 20 percent quantile values of > # the fitted distribution, which are called the 5, 10, 20 percent hazardous concentrations (HC5, HC10, HC20) > # in ecotoxicology, followed with calculations of their confidence intervals with various definitions. > # > data(salinity) > log10LC50 <-log10(salinity) > flncens <- fitdistcens(log10LC50,"norm") > quantile(flncens, probs = c(0.05, 0.1, 0.2)) Estimated quantiles for each specified probability (censored data) p=0.05 p=0.1 p=0.2 estimate 1.11584 1.194121 1.288913 > blncens <- bootdistcens(flncens,niter=nbboot) > quantile(blncens, probs = c(0.05, 0.1, 0.2)) (original) estimated quantiles for each specified probability (censored data) p=0.05 p=0.1 p=0.2 estimate 1.11584 1.194121 1.288913 Median of bootstrap estimates p=0.05 p=0.1 p=0.2 estimate 1.132785 1.211311 1.306336 two-sided 95 % CI of each quantile p=0.05 p=0.1 p=0.2 2.5 % 1.077460 1.16470 1.270341 97.5 % 1.194252 1.25752 1.334133 > quantile(blncens, probs = c(0.05, 0.1, 0.2), CI.type = "greater") (original) estimated quantiles for each specified probability (censored data) p=0.05 p=0.1 p=0.2 estimate 1.11584 1.194121 1.288913 Median of bootstrap estimates p=0.05 p=0.1 p=0.2 estimate 1.132785 1.211311 1.306336 left bound of one-sided 95 % CI of each quantile p=0.05 p=0.1 p=0.2 5 % 1.085549 1.171742 1.276115 > quantile(blncens, probs = c(0.05, 0.1, 0.2), CI.level = 0.9) (original) estimated quantiles for each specified probability (censored data) p=0.05 p=0.1 p=0.2 estimate 1.11584 1.194121 1.288913 Median of bootstrap estimates p=0.05 p=0.1 p=0.2 estimate 1.132785 1.211311 1.306336 two-sided 90 % CI of each quantile p=0.05 p=0.1 p=0.2 5 % 1.085549 1.171742 1.276115 95 % 1.191571 1.255181 1.332207 > > > # (3) Estimation of quantiles of the fitted distribution (fln) > # and two-sided 95 percent confidence intervals for various > # probabilities using non-parametric bootstrap with 101 iterations > # > bln.np <- bootdist(fln, bootmethod = "nonparam", niter = nbboot) > quantile(bln.np, probs = c(0.05, 0.1, 0.2)) (original) estimated quantiles for each specified probability (non-censored data) p=0.05 p=0.1 p=0.2 estimate 1.744227 2.080093 2.4868 Median of bootstrap estimates p=0.05 p=0.1 p=0.2 estimate 1.759577 2.067666 2.4385 two-sided 95 % CI of each quantile p=0.05 p=0.1 p=0.2 2.5 % 1.200046 1.558008 1.984949 97.5 % 2.528877 2.746490 3.010002 > > # (4) Fit of a loglogistic distribution on the same acute toxicity values and > # estimation of the 5 percent quantile (HC5) of the fitted distribution > # and associated two-sided 95 percent confidence interval > # > fll <- fitdist(log10ATV, "logis") > bll <- bootdist(fll, bootmethod = "param", niter = nbboot) > # in log10(ATV) > HC5ll <- quantile(bll, probs = 0.05) > HC5ll (original) estimated quantiles for each specified probability (non-censored data) p=0.05 estimate 1.780291 Median of bootstrap estimates p=0.05 estimate 1.837704 two-sided 95 % CI of each quantile p=0.05 2.5 % 1.450846 97.5 % 2.636959 > # in ATV > 10^(HC5ll$basequant) numeric(0) > 10^(HC5ll$quantCI) p=0.05 2.5 % 28.23878 97.5 % 433.47037 > > proc.time() user system elapsed 1.71 0.31 2.03