| bootstrap_ci | R Documentation |
Computes non-parametric percentile bootstrap confidence intervals for the
parameters of the best-fit distribution in a fitverse object.
Optionally also bootstraps confidence intervals for T-year return levels.
bootstrap_ci(fit,
B = 999L,
conf = 0.95,
return_periods = NULL,
progress = NULL,
seed = NULL,
verbose = TRUE)
## S3 method for class 'fitverse_bootstrap'
print(x, ...)
fit |
An object of class |
B |
Integer: number of bootstrap replicates. Default |
conf |
Numeric in |
return_periods |
Numeric vector of return periods for which bootstrap CIs on return
levels should be computed. |
progress |
Optional function of the form |
seed |
Integer or |
verbose |
Logical: print a progress message? Default |
x |
An object of class |
... |
Currently unused. |
The non-parametric percentile bootstrap proceeds as follows:
Draw B bootstrap samples of size n with replacement
from the observed data.
Re-fit the same distribution and estimation method to each sample,
using the same internal engine as fitverse().
Collect the B \times k matrix of parameter estimates
(where k is the number of parameters).
For each parameter, report the \alpha/2 and 1 - \alpha/2
empirical percentiles of the bootstrap distribution as the lower and
upper confidence bounds.
Replicates that fail to converge are excluded; a warning is issued if more than 10% fail.
When return_periods is supplied, the T-year return level is computed
for each bootstrap replicate using return_level(), and the
percentile CI is reported for each T.
An S3 object of class "fitverse_bootstrap" with the following
elements:
params_ciData frame with one row per parameter and columns:
parameter, estimate, lower, upper,
se_boot (bootstrap standard error).
return_level_ciData frame (or NULL if return_periods = NULL) with columns:
T, return_level, lower, upper.
boot_paramsNumeric matrix of dimension B_{eff} \times k: all successful
bootstrap parameter estimates. Useful for plotting bootstrap
distributions.
BInteger: number of replicates requested.
B_effInteger: number of successful replicates.
confNumeric: confidence level.
dist_keyCharacter: distribution key.
methodCharacter: estimation method.
Karuna G. Reddy karuna.reddy@auckland.ac.nz
M. G. M. Khan mgm.khan@usp.ac.fj
Efron, B. and Tibshirani, R. J. (1993). An Introduction to the Bootstrap. Chapman and Hall, New York.
Davison, A. C. and Hinkley, D. V. (1997). Bootstrap Methods and Their Application. Cambridge University Press.
return_level for point estimates without CIs.
fitverse for the initial fitting step.
set.seed(42)
x <- rgamma(200, shape = 2, rate = 0.5)
fit <- fitverse(x, dists = "gamma", plot = FALSE, verbose = FALSE)
boot <- bootstrap_ci(fit, B = 499, conf = 0.95, seed = 1, verbose = FALSE)
print(boot)
# Parameter CI data frame
boot$params_ci
# With return-level CIs
boot2 <- bootstrap_ci(fit, B = 499, return_periods = c(10, 50, 100),
seed = 1, verbose = FALSE)
boot2$return_level_ci
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.