comp_mms_var: Generates list containing several estimates of the variance

Description Usage Arguments Value Examples

Description

comp_mms_var returns a list containing the requested estimates of the variance, together with the assumptions behind which these estimates are consistent.

Usage

1
2
3
4
5
6
7
comp_mms_var(
  mod_fit,
  boot_emp = NULL,
  boot_sub = NULL,
  boot_res = NULL,
  boot_mul = NULL
)

Arguments

mod_fit

An lm (OLS) object

boot_emp

(list) In the case of empirical bootstrap the expected input is of the form #' list(B = 10, m = 100). Here the named element m is optional e.g. list(B = 10) is valid, or passed in as an explicit NULL e.g. list(B = 10, m = NULL). Note that technically B, m should both be positive integers, but this assertion checking is handled explicitly in the comp_boot_emp function. So although passing in list(B = -15, m = -20) will pass this function without errors, these will be addressed explicitly in comp_boot_emp as invalid inputs.

boot_sub

(list) TODO: ADD

boot_res

(list) : In the case of residual bootstrap the expected input is of the form list(B = 10). Note that technically B should be a positive integer, but this assertion checking is handled explicitly in the comp_boot_res function. So although passing in list(B = -15) will pass this function without errors, these will be addressed explicitly in comp_boot_res as invalid inputs.

boot_mul

(list) : In the case of multiplier bootstrap the expected input is of the form list(B = 10, weights_type = "rademacher"). Here the named element weights_type is optional e.g. list(B = 10) is valid, or passed in as an explicit NULL e.g. list(B = 10, weights_type = NULL). Note that technically B should be a positive integer, and weights_type should be a character vector (see comp_boot_mul), but this assertion checking is handled explicitly in the comp_boot_mul function. So although passing in list(B = -15, m = "test") will pass this function without errors, these will be addressed explicitly in comp_boot_mul as invalid inputs.

Value

A list containing the several types of variance estimates requested by the user, including the sandwich and the the variance returned by lm.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
## Not run: 
# 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_mms_var(mod_fit,
boot_mul = list(B = 100, weights_type = "rademacher"),
boot_sub = list(B = 100, m = 50))

# print output
print(out)

## End(Not run)

shamindras/maars documentation built on Sept. 21, 2021, 2:50 a.m.