diag_boot_qqn: Normal Q-Q plot of the terms in an output of the bootstrap...

Description Usage Arguments Value Examples

Description

diag_boot_qqn produces a normal Q-Q plot for each regressors included in the estimates on the bootstrapped datasets. This function is a wrapper for the stat_qq function.

Usage

1
diag_boot_qqn(boot_out, boot_type)

Arguments

boot_out

A tibble of the model's coefficients estimated (term and estimate) on the bootstrapped datasets, the size of each bootstrapped dataset (m), the size of the original dataset (n), and the number of the bootstrap repetition (b).

boot_type

(character) : The (abbreviate) type of bootstrap estimates to use for the plot

Value

A ggplot2 object containing normal Q-Q plot for each regressor in boot_out. Each panel corresponds to a different coefficient, whose name appears in the panel's titles.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## Not run: 
# Obtain normal Q-Q plot of the
n <- 1e3
X1 <- stats::rnorm(n, 0, 1)
X2 <- stats::rnorm(n, 0, 3)
y <- 2 + X1 + X2 * 0.3 + stats::rnorm(n, 0, 1)
reg_df <- tibble::tibble(y = y, X1 = X1, X2 = X2, n_obs = 1:length(X1))

# Fit a linear model (OLS) to the data
mod_fit <- stats::lm(y ~ X1 + X2, reg_df)
mms_fit <- comp_var(mod_fit, boot_emp = list(B = 50))
boot_var <- purrr::pluck(mms_fit, 'var', 'var_boot_emp')
# Display the output
diag_boot_qqn(purrr::pluck(boot_var, 'boot_out'), boot_type = 'emp')

## End(Not run)

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