R/ols-boot-multiplier.R
comp_boot_mul.Rd
The multiplier bootstrap calculated for a single replication
for an OLS fitted dataset is given by the following expression:
$$\frac{1}{n}\sum_{i=1}^{n} e_{i}\widehat{J}^{-1}X_{i}(Y_{i}-X_{i}^{T} \widehat{\beta})$$
This wrapper function calls on the helper function comp_boot_mul_ind
. See its documentation
for how a single instance is run.
comp_boot_mul(mod_fit, B, weights_type = "rademacher")
mod_fit | An |
---|---|
B | The number of bootstrap replications. |
weights_type | The type of multiplier bootstrap weights to generate.
Based on the |
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
).
if (FALSE) { # Simulate data from a linear model set.seed(35542) n <- 1e2 X <- stats::rnorm(n, 0, 1) y <- 2 + X * 1 + stats::rnorm(n, 0, 1) # Fit the linear model using OLS (ordinary least squares) lm_fit <- stats::lm(y ~ X) # Run the multiplier bootstrap on the fitted (OLS) linear model set.seed(162632) comp_boot_mul(lm_fit, B = 15, weights_type = "std_gaussian") }