check_fn_args_comp_mms_var_boot_ind: Assertion Checks for individual 'comp_mms_var' function...

Description Usage Arguments Value Examples

View source: R/ols-var.R

Description

check_fn_args_comp_mms_var_boot_ind is used to assess whether the arguments are correctly specified in list format and returns an error message if they do not match the correct specification

Usage

1

Arguments

inp_list

(list) : A list containing the relevant input parameters for empirical bootstrap (comp_boot_emp), residual bootstrap (comp_boot_res), and multiplier bootstrap (comp_boot_mul). 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. 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. 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.

boot_type

(character) : Can take one of the values c('boot_emp', 'boot_sub', 'boot_res', 'boot_mul'), which are for empirical, subsampling, residual, and multiplier bootstrap respectively.

Value

: A TRUE if assertions pass, or an error if there is an assertion failure.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## Not run: 
# Multiplier Bootstrap input list assertion checking

# valid since the named arguments are B, weights_type
testthat::expect_true(check_fn_args_comp_mms_var_boot_ind(
  inp_list = list(B = 10, weights_type = "rademacher"),
  boot_type = "boot_mul"
))

# valid since the named arguments are B, weights_type i.e. weights_type is NULL
testthat::expect_true(check_fn_args_comp_mms_var_boot_ind(
  inp_list = list(B = 10, weights_type = NULL),
  boot_type = "boot_mul"
))

## End(Not run)

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