comp_boot_res: A wrapper for the residual bootstrap of a fitted OLS...

Description Usage Arguments Details Value Examples

View source: R/ols-boot-residual.R

Description

comp_boot_res is a wrapper for the empirical bootstrap of a fitted lm model.

Usage

1
comp_boot_res(mod_fit, B = 100)

Arguments

mod_fit

An object of class lm to fit on the data. This object should contain the formula and the data.

B

Bootstrap repetitions or number of bootstrap samples to be drawn.

Details

The residual bootstrap consists of fitting the chosen statistical model (mod_fit) B times. Each of the B datasets consists of the original independent variables and of dependent variable given by the sum of the estimates of the original model and a bootstrap versions of the residuals.

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).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## Not run: 
# 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_res(lm_fit, B = 100)

print(out)

## End(Not run)

shamindras/maar documentation built on Sept. 19, 2021, 10:21 p.m.