# bootdistcens: Bootstrap simulation of uncertainty for censored data In fitdistrplus: Help to Fit of a Parametric Distribution to Non-Censored or Censored Data

## Description

Uses nonparametric bootstrap resampling in order to simulate uncertainty in the parameters of the distribution fitted to censored data.

## Usage

 ```1 2 3 4 5 6 7 8``` ```bootdistcens(f, niter = 1001, silent = TRUE, parallel = c("no", "snow", "multicore"), ncpus) ## S3 method for class 'bootdistcens' print(x, ...) ## S3 method for class 'bootdistcens' plot(x, ...) ## S3 method for class 'bootdistcens' summary(object, ...) ```

## Arguments

 `f` An object of class `"fitdistcens"`, output of the `fitdistcens` function. `niter` The number of samples drawn by bootstrap. `silent` A logical to remove or show warnings and errors when bootstraping. `parallel` The type of parallel operation to be used, `"snow"` or `"multicore"` (the second one not being available on Windows), or `"no"` if no parallel operation. `ncpus` Number of processes to be used in parallel operation : typically one would fix it to the number of available CPUs. `x` An object of class `"bootdistcens"`. `object` An object of class `"bootdistcens"`. `...` Further arguments to be passed to generic methods.

## Details

Samples are drawn by nonparametric bootstrap (resampling with replacement from the data set). On each bootstrap sample the function `mledist` is used to estimate bootstrapped values of parameters. When `mledist` fails to converge, `NA` values are returned. Medians and 2.5 and 97.5 percentiles are computed by removing `NA` values. The medians and the 95 percent confidence intervals of parameters (2.5 and 97.5 percentiles) are printed in the summary. If inferior to the whole number of iterations, the number of iterations for which `mledist` converges is also printed in the summary.

The plot of an object of class `"bootdistcens"` consists in a scatterplot or a matrix of scatterplots of the bootstrapped values of parameters. It uses the function `stripchart` when the fitted distribution is characterized by only one parameter, and the function `plot` in other cases. In these last cases, it provides a representation of the joint uncertainty distribution of the fitted parameters.

It is possible to accelerate the bootstrap using parallelization. We recommend you to use `parallel = "multicore"`, or `parallel = "snow"` if you work on Windows, and to fix `ncpus` to the number of available processors.

## Value

`bootdistcens` returns an object of class `"bootdistcens"`, a list with 6 components,

 `estim` a data frame containing the bootstrapped values of parameters. `converg` a vector containing the codes for convergence of the iterative method used to estimate parameters on each bootstraped data set. `method` A character string coding for the type of resampling : in this case `"nonparam"` as it is the only available method for censored data. `nbboot` The number of samples drawn by bootstrap. `CI` bootstrap medians and 95 percent confidence percentile intervals of parameters. `fitpart` The object of class `"fitdistcens"` on which the bootstrap procedure was applied.

Generic functions:

`print`

The print of a `"bootdistcens"` object shows the bootstrap parameter estimates. If inferior to the whole number of bootstrap iterations, the number of iterations for which the estimation converges is also printed.

`summary`

The summary provides the median and 2.5 and 97.5 percentiles of each parameter. If inferior to the whole number of bootstrap iterations, the number of iterations for which the estimation converges is also printed in the summary.

`plot`

The plot shows the bootstrap estimates with the `stripchart` function for univariate parameters and `plot` function for multivariate parameters.

## Author(s)

Marie-Laure Delignette-Muller and Christophe Dutang.

## References

Cullen AC and Frey HC (1999), Probabilistic techniques in exposure assessment. Plenum Press, USA, pp. 181-241.

Delignette-Muller ML and Dutang C (2015), fitdistrplus: An R Package for Fitting Distributions. Journal of Statistical Software, 64(4), 1-34.

See `fitdistrplus` for an overview of the package. `fitdistcens`, `mledist`, `quantile.bootdistcens` for another generic function to calculate quantiles from the fitted distribution and its bootstrap results and `CIcdfplot` for adding confidence intervals on quantiles to a CDF plot of the fitted distribution.
 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56``` ```# We choose a low number of bootstrap replicates in order to satisfy CRAN running times # constraint. # For practical applications, we recommend to use at least niter=501 or niter=1001. # (1) Fit of a normal distribution to fluazinam data in log10 # followed by nonparametric bootstrap and calculation of quantiles # with 95 percent confidence intervals # data(fluazinam) (d1 <-log10(fluazinam)) f1 <- fitdistcens(d1, "norm") b1 <- bootdistcens(f1, niter = 101) b1 summary(b1) plot(b1) quantile(b1) CIcdfplot(b1, CI.output = "quantile") # (2) Estimation of the mean of the normal distribution # by maximum likelihood with the standard deviation fixed at 1 # using the argument fix.arg # followed by nonparametric bootstrap # and calculation of quantiles with 95 percent confidence intervals # f1b <- fitdistcens(d1, "norm", start = list(mean = 1),fix.arg = list(sd = 1)) b1b <- bootdistcens(f1b, niter = 101) summary(b1b) plot(b1b) quantile(b1b) # (3) comparison of sequential and parallel versions of bootstrap # to be tried with a greater number of iterations (1001 or more) # ## Not run: niter <- 1001 data(fluazinam) d1 <-log10(fluazinam) f1 <- fitdistcens(d1, "norm") # sequential version ptm <- proc.time() summary(bootdistcens(f1, niter = niter)) proc.time() - ptm # parallel version using snow require(parallel) ptm <- proc.time() summary(bootdistcens(f1, niter = niter, parallel = "snow", ncpus = 4)) proc.time() - ptm # parallel version using multicore (not available on Windows) ptm <- proc.time() summary(bootdistcens(f1, niter = niter, parallel = "multicore", ncpus = 4)) proc.time() - ptm ## End(Not run) ```