comp_boot_emp is a wrapper for the empirical bootstrap of a fitted lm or glm model.

comp_boot_emp(mod_fit, B = 100, m = NULL, replace = TRUE)

Arguments

mod_fit

An object of class lm or glm to fit on the data. This object should contain the formula, the data, and, in case of glm, the family.

B

Bootstrap repetitions or number of bootstrap samples to be drawn.

m

Number of observations to be sampled with replacement from the dataset for each bootstrap repetition.

replace

TODO: ADD

Value

A list containing the following elements. var_type: The type of estimator for the variance of the coefficients estimates. An abbreviated string representing the type of the estimator of the variance (var_type_abb). var_summary: A tibble containing the summary statistics for the model: terms (term), standard errors (std.error), statistics (statistic), p-values (p.values). The format of the tibble is exactly identical to the one generated by tidy, but the standard errors and p-values are computed via the bootstrap. var_assumptions: The assumptions under which the estimator of the variance is consistent. cov_mat: The covariance matrix of the coefficients estimates. boot_out: A tibble of the model's coefficients estimated (term and estimate) on the bootstrapped datasets, the size of the original dataset (n), and the number of the bootstrap repetition (b). In case of empirical bootstrap, it will also contain the size of each bootstrapped dataset (m).

Details

The empirical bootstrap consists of fitting the chosen statistical model (mod_fit) onto B bootstrap versions of size m of the dataset.

Examples

if (FALSE) { # Obtain estimates of the coefficients on bootstrapped versions of the dataset set.seed(35542) n <- 1e3 X <- stats::rnorm(n, 0, 1) y <- 2 + X * 1 + stats::rnorm(n, 0, 1) lm_fit <- stats::lm(y ~ X) out <- comp_boot_emp(lm_fit, B = 100, m = 1000) print(out) }