comp_sand_var: Compute the sandwich estimator of standard errors for OLS

Description Usage Arguments Details Value References Examples

View source: R/ols-sandwich-lm-var.R

Description

Compute the sandwich estimator of standard errors for ordinary least squares (OLS) regression, \insertCite@see @white1980usinglsapproxunknownregfuncs and @white1980heteroskedasticconsistentcovest;textualmaars. For more details \insertCite@see also @buja2019modelsasapproximationspart1 and @buja2019modelsasapproximationspart2;textualmaars.

Usage

1
comp_sand_var(mod_fit)

Arguments

mod_fit

A lm (OLS) object.

Details

The function computes the sandwich estimator for the OLS regression passed in mod_fit and returns a tibble with summary information about the components of the model based on the sandwich standard errors.

Value

A list containing 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).

References

\insertAllCited

Examples

1
2
3
4
5
6
7
8
9
## Not run: 
set.seed(674748)
n <- 1e5
X <- stats::rnorm(n, 0, 1)
y <- 2 + X * 1 + stats::rnorm(n, 0, 10)
lm_fit <- stats::lm(y ~ X)
sandwich_qr_std_err <- comp_sand_var(lm_fit)

## End(Not run)

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