R Under development (unstable) (2025-01-06 r87534 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.866457 2.151683 2.525895 two-sided 95 % CI of each quantile p=0.05 p=0.1 p=0.2 2.5 % 1.305222 1.712629 2.205281 97.5 % 2.283318 2.526957 2.856340 > 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.866457 2.151683 2.525895 left bound of one-sided 95 % CI of each quantile p=0.05 p=0.1 p=0.2 5 % 1.31762 1.719292 2.205561 > 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.866457 2.151683 2.525895 two-sided 90 % CI of each quantile p=0.05 p=0.1 p=0.2 5 % 1.317620 1.719292 2.205561 95 % 2.276911 2.502508 2.809914 > > # (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.129852 1.208033 1.297331 two-sided 95 % CI of each quantile p=0.05 p=0.1 p=0.2 2.5 % 1.060959 1.148795 1.252666 97.5 % 1.170799 1.244284 1.333268 > 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.129852 1.208033 1.297331 left bound of one-sided 95 % CI of each quantile p=0.05 p=0.1 p=0.2 5 % 1.068751 1.155951 1.25656 > 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.129852 1.208033 1.297331 two-sided 90 % CI of each quantile p=0.05 p=0.1 p=0.2 5 % 1.068751 1.155951 1.256560 95 % 1.170255 1.242617 1.330241 > > > # (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 2.122784 2.38529 2.703163 two-sided 95 % CI of each quantile p=0.05 p=0.1 p=0.2 2.5 % 1.207870 1.601569 2.078306 97.5 % 2.898862 3.098630 3.340535 > > # (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.791141 two-sided 95 % CI of each quantile p=0.05 2.5 % 1.251991 97.5 % 2.575253 > # in ATV > 10^(HC5ll$basequant) numeric(0) > 10^(HC5ll$quantCI) p=0.05 2.5 % 17.86452 97.5 % 376.05674 > > proc.time() user system elapsed 1.09 0.17 1.21