bootdistcens | R Documentation |
Uses nonparametric bootstrap resampling in order to simulate uncertainty in the parameters of the distribution fitted to censored data.
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, ...)
f |
An object of class |
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, |
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 |
object |
An object of class |
... |
Further arguments to be passed to generic methods. |
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.
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 |
nbboot |
The number of samples drawn by bootstrap. |
CI |
bootstrap medians and 95 percent confidence percentile intervals of parameters. |
fitpart |
The object of class |
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.
Marie-Laure Delignette-Muller and Christophe Dutang.
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.
# 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) # 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 = 2)) proc.time() - ptm # parallel version using multicore (not available on Windows) ptm <- proc.time() summary(bootdistcens(f1, niter = niter, parallel = "multicore", ncpus = 2)) proc.time() - ptm
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.