# Sensitivity analysis for an unstandardized regression coefficient
# with two predictors at a modest R squared. The Monte Carlo loop is
# run with a small number of generations (G) here so the example is
# fast; use a larger G (for example G = 1000) in real applications.
set.seed(113)
Sigma_X <- matrix(c(1, 0.3, 0.3, 1), nrow = 2)
cov_YX <- c(0.4, 0.3)
ss_aipe_reg_coef_sensitivity(
true_var_Y = 1, true_cov_YX = cov_YX, true_cov_XX = Sigma_X,
estimated_var_Y = 1, estimated_cov_YX = cov_YX, estimated_cov_XX = Sigma_X,
which_predictor = 1, w = 0.20, conf_level = 0.95,
G = 100, print_iter = FALSE
)
Run the code above in your browser using DataLab