bmdboot | R Documentation |
Computes 95 percent confidence intervals on x-fold and z-SD benchmark doses by bootstrap.
bmdboot(r, items = r$res$id, niter = 1000,
conf.level = 0.95,
tol = 0.5, progressbar = TRUE,
parallel = c("no", "snow", "multicore"), ncpus)
## S3 method for class 'bmdboot'
print(x, ...)
## S3 method for class 'bmdboot'
plot(x, BMDtype = c("zSD", "xfold"), remove.infinite = TRUE,
by = c("none", "trend", "model", "typology"),
CI.col = "blue", BMD_log_transfo = TRUE, ...)
r |
An object of class |
items |
A character vector specifying the identifiers of the items for which you want the computation of confidence intervals. If omitted the computation is done for all the items. |
niter |
The number of samples drawn by bootstrap. |
conf.level |
Confidence level of the intervals. |
tol |
The tolerance in term of proportion of bootstrap samples on which the fit of the model is successful (if this proportion is below the tolerance, NA values are given for the limits of the confidence interval. |
progressbar |
If |
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 |
BMDtype |
The type of BMD to plot, |
remove.infinite |
If TRUE the confidence intervals with non finite upper bound are not plotted. |
by |
If not at |
CI.col |
The color to draw the confidence intervals. |
BMD_log_transfo |
If TRUE, default option, a log transformation of the BMD is used in the plot. |
... |
Further arguments passed to graphical or print functions. |
Non-parametric bootstrapping is used, where mean centered residuals are bootstrapped.
For each item, bootstrapped parameter estimates are obtained by fitting the model on each of the resampled data sets. If the fitting procedure fails to converge in more than tol*100% of the cases, NA values are given for the confidence interval. Otherwise, bootstraped
BMD are computed from bootstrapped parameter estimates using the same method as
in bmdcalc
.
Confidence intervals on BMD are then
computed using percentiles of the bootstrapped BMDs.
For example 95 percent confidence intervals are
computed using 2.5 and 97.5 percentiles of the bootstrapped BMDs.
In cases where the bootstrapped BMD cannot be estimated as
not reached at the highest tested dose or not reachable due to model asymptotes,
it was given an infinite value Inf
, so as to enable the computation
of the lower limit of the BMD confidence interval if a sufficient number of bootstrapped BMD values were estimated
to finite values.
bmdboot
returns an object of class "bmdboot"
, a list with 3 components:
res |
a data frame reporting the results of the fit, BMD computation and bootstrap
on each specified item sorted in the ascending order of the adjusted p-values. The different columns correspond to
the identifier of each item ( |
z |
Value of z given in input to define the BMD-zSD. |
x |
Value of x given in input as a percentage to define the BMD-xfold. |
tol |
The tolerance given in input in term of tolerated proportion of failures of fit on bootstrapped samples. |
niter |
The number of samples drawn by bootstrap (given in input). |
Marie-Laure Delignette-Muller
Huet S, Bouvier A, Poursat M-A, Jolivet E (2003) Statistical tools for nonlinear regression: a practical guide with S-PLUS and R examples. Springer, Berlin, Heidelberg, New York.
See bmdcalc
for details about the computation of benchmark doses.
# (1) a toy example (a very small subsample of a microarray data set)
#
datafilename <- system.file("extdata", "transcripto_very_small_sample.txt",
package = "DRomics")
# to test the package on a small but not very small data set
# use the following commented line
# datafilename <- system.file("extdata", "transcripto_sample.txt", package = "DRomics")
o <- microarraydata(datafilename, check = TRUE, norm.method = "cyclicloess")
s_quad <- itemselect(o, select.method = "quadratic", FDR = 0.001)
f <- drcfit(s_quad, progressbar = TRUE)
r <- bmdcalc(f)
set.seed(1234) # to get reproducible results with a so small number of iterations
(b <- bmdboot(r, niter = 5)) # with a non reasonable value for niter
# !!!! TO GET CORRECT RESULTS
# !!!! niter SHOULD BE FIXED FAR LARGER , e.g. to 1000
# !!!! but the run will be longer
b$res
plot(b) # plot of BMD.zSD after removing of BMDs with infinite upper bounds
# same plot in raw scale (without log transformation of BMD values)
plot(b, BMD_log_transfo = FALSE)
# plot of BMD.zSD without removing of BMDs
# with infinite upper bounds
plot(b, remove.infinite = FALSE)
# bootstrap on only a subsample of items
# with a greater number of iterations
chosenitems <- r$res$id[1:5]
(b.95 <- bmdboot(r, items = chosenitems,
niter = 1000, progressbar = TRUE))
b.95$res
# Plot of fits with BMD values and confidence intervals
# with the default BMD.zSD
plot(f, items = chosenitems, BMDoutput = b.95, BMDtype = "zSD")
# with the default BMD.xfold
plot(f, items = chosenitems, BMDoutput = b.95, BMDtype = "xfold")
# same bootstrap but changing the default confidence level (0.95) to 0.90
(b.90 <- bmdboot(r, items = chosenitems,
niter = 1000, conf.level = 0.9, progressbar = TRUE))
b.90$res
# (2) an example on a microarray data set (a subsample of a greater data set)
#
datafilename <- system.file("extdata", "transcripto_sample.txt", package="DRomics")
(o <- microarraydata(datafilename, check = TRUE, norm.method = "cyclicloess"))
(s_quad <- itemselect(o, select.method = "quadratic", FDR = 0.001))
(f <- drcfit(s_quad, progressbar = TRUE))
(r <- bmdcalc(f))
(b <- bmdboot(r, niter = 100)) # niter to put at 1000 for a better precision
# different plots of BMD-zSD
plot(b)
plot(b, by = "trend")
plot(b, by = "model")
plot(b, by = "typology")
# a plot of BMD-xfold (by default BMD-zSD is plotted)
plot(b, BMDtype = "xfold")
# (3) Comparison of parallel and non parallel implementations
#
# to be tested with a greater number of iterations
if(!requireNamespace("parallel", quietly = TRUE)) {
if(parallel::detectCores() > 1) {
system.time(b1 <- bmdboot(r, niter = 100, progressbar = TRUE))
system.time(b2 <- bmdboot(r, niter = 100, progressbar = FALSE, parallel = "snow", ncpus = 2))
}}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.