e_vs_r {exactamente} | R Documentation |
Compare Exact Bootstrap vs Regular Bootstrap
Description
This function runs the exact and regular bootstrap functions on a dataset, summarizes the results, and provides a comparative plot. It provides a convenient way to compare these two methods of bootstrapping.
Usage
e_vs_r(
data,
n_bootstraps = 10000,
check_size = TRUE,
anon = function(x) (mean(x)),
lb = 0.025,
ub = 0.975,
density_args,
title = "Comparison of Bootstrap Distributions"
)
Arguments
data |
A numeric vector of data values to be bootstrapped. |
n_bootstraps |
The number of bootstrap samples to generate. Defaults to 10000. |
check_size |
Logical indicating if a check should be performed to ensure the dataset has less than 10 observations for the exact bootstrap. Defaults to TRUE. |
anon |
An anonymous function to compute the statistic of interest on each bootstrap sample. Defaults to mean. |
lb |
Lower bound for the confidence interval. Defaults to 0.025. |
ub |
Upper bound for the confidence interval. Defaults to 0.975. |
density_args |
Pass additional arguments to stats::density |
title |
Plot title |
Value
A list containing two items:
summary_table: A summary table containing the mode, median, mean, standard deviation, and confidence interval for each bootstrap method.
comp_plot: A ggplot object comparing the bootstrap distributions.
Examples
set.seed(123)
data <- rnorm(5)
results <- e_vs_r(data)
print(results$summary_table)
print(results$comp_plot)