R Under development (unstable) (2025-07-02 r88374 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.838755 2.172663 2.579592 two-sided 95 % CI of each quantile p=0.05 p=0.1 p=0.2 2.5 % 1.445436 1.795132 2.210879 97.5 % 2.157869 2.471998 2.868661 > 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.838755 2.172663 2.579592 left bound of one-sided 95 % CI of each quantile p=0.05 p=0.1 p=0.2 5 % 1.476906 1.835161 2.253566 > 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.838755 2.172663 2.579592 two-sided 90 % CI of each quantile p=0.05 p=0.1 p=0.2 5 % 1.476906 1.835161 2.253566 95 % 2.127306 2.436990 2.844549 > > # (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.111792 1.191247 1.288582 two-sided 95 % CI of each quantile p=0.05 p=0.1 p=0.2 2.5 % 1.084201 1.161636 1.253298 97.5 % 1.147247 1.228128 1.327700 > 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.111792 1.191247 1.288582 left bound of one-sided 95 % CI of each quantile p=0.05 p=0.1 p=0.2 5 % 1.085954 1.164669 1.255778 > 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.111792 1.191247 1.288582 two-sided 90 % CI of each quantile p=0.05 p=0.1 p=0.2 5 % 1.085954 1.164669 1.255778 95 % 1.145503 1.225366 1.325337 > > > # (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.666158 1.992048 2.397873 two-sided 95 % CI of each quantile p=0.05 p=0.1 p=0.2 2.5 % 1.483116 1.846121 2.261828 97.5 % 2.467996 2.709093 3.001785 > > # (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.458906 two-sided 95 % CI of each quantile p=0.05 2.5 % 0.9602841 97.5 % 1.9592331 > # in ATV > 10^(HC5ll$basequant) numeric(0) > 10^(HC5ll$quantCI) p=0.05 2.5 % 9.126075 97.5 % 91.040177 > > proc.time() user system elapsed 1.71 0.18 1.87