R/ols-diag-plot.R
diag_boot_qqn.Rd
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.
diag_boot_qqn(boot_out, boot_type)
boot_out | A tibble of the model's coefficients estimated ( |
---|---|
boot_type | ( |
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.
if (FALSE) { # 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') }