Generates an object of class "maars_lm", "lm"
containing
estimates of the variance of the coefficients in the regression
model.
comp_var( mod_fit, boot_emp = NULL, boot_sub = NULL, boot_res = NULL, boot_mul = NULL )
mod_fit | An lm (OLS) object |
---|---|
boot_emp | (list) In the case of empirical bootstrap the expected input
is of the form #' |
boot_sub | (list) TODO: ADD |
boot_res | (list) : In the case of residual bootstrap the expected
input is of the form |
boot_mul | (list) : In the case of multiplier bootstrap the expected
input is of the form |
A "maars_lm" object containing the estimates of the variance of the
regression coefficients, including the sandwich and the variance
returned by stats::lm
.
The "maars_lm" object is basically an "lm" object with additional
attributes (the additional estimates of the coefficients variance),
which are stored within "var". For example, the estimates of the empirical
bootstrap will be stored within "var$var_boot_emp".
Each of the nested lists contains the following elements: the type of estimator of
of the variance (var_type
); An abbreviated string representing the
type of the estimator of the variance (var_type_abb
); the summary
statistics of mod_fit
based on this estimator of the variance
(e.g., standard errors and p-values) (var_summary
); the assumptions
under which the estimator of the variance is consistent
(var_assumptions
); the covariance matrix for the coefficients
estimates (cov_mat
).
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) mod_fit <- stats::lm(y ~ X) # Run the multiplier bootstrap on the fitted (OLS) linear model set.seed(162632) out <- comp_var(mod_fit, boot_mul = list(B = 100, weights_type = "rademacher")) # print output print(out) print(out$var$var_boot_mul) }