Sensitivity Analysis for Sample Size Planning From the Accuracy in Parameter Estimation Perspective for the Unstandardized Regression Coefficient
Source:R/ss_aipe_rc_sensitivity.R
ss_aipe_rc_sensitivity.RdPerforms a sensitivity analysis when planning sample size from the Accuracy in Parameter Estimation Perspective for the unstandardized regression coefficient.
Usage
ss_aipe_rc_sensitivity(
true_var_Y = NULL,
true_cov_YX = NULL,
true_cov_XX = NULL,
estimated_var_Y = NULL,
estimated_cov_YX = NULL,
estimated_cov_XX = NULL,
specified_N = NULL,
which_predictor = 1,
w = NULL,
noncentral = FALSE,
standardize = FALSE,
conf_level = 0.95,
assurance = NULL,
G = 1000,
print_iter = TRUE,
save = FALSE,
filename = "ss_aipe_rc_sensitivity_result.csv"
)Arguments
- true_var_Y
Population variance of the dependent variable (Y)
- true_cov_YX
Population covariances vector between the p predictor variables and the dependent variable (Y)
- true_cov_XX
Population covariance matrix of the p predictor variables
- estimated_var_Y
Estimated variance of the dependent variable (Y)
- estimated_cov_YX
Estimated covariances vector between the p predictor variables and the dependent variable (Y)
- estimated_cov_XX
Estimated Population covariance matrix of the p predictor variables
- specified_N
Directly specified sample size (instead of planning one from the estimated covariance structure)
- which_predictor
identifies which of the p predictors is of interest
- w
desired confidence interval width for the regression coefficient of interest
- noncentral
specify with a
TRUEorFALSEstatement whether or not the noncentral approach to sample size planning should be used- standardize
specify with a
TRUEorFALSEstatement whether or not the regression coefficient will be standardized; default isTRUE- conf_level
desired level of confidence for the computed interval (i.e., 1 - the Type I error rate)
- assurance
degree of certainty that the obtained confidence interval will be sufficiently narrow (i.e., the probability that the observed interval will be no larger than desired)
- G
the number of generations (i.e., replications) of the simulation within the function
- print_iter
specify with a
TRUE/FALSEstatement if the iteration number should be printed as the simulation within the function runs- save
option to save simulation results. It can be saved with
save = TRUEoutside of the printed results- filename
the name of the file that simulation results will be saved to
Value
A data.frame with columns term and value
summarizing the Monte Carlo sensitivity analysis. This function
delegates to ss_aipe_reg_coef_sensitivity and inherits
its return structure: mean / median / SD summaries of the realized
unstandardized regression coefficient, the realized interval widths,
and the realized squared multiple correlation coefficient; the
proportion of intervals at or below the planning target
(pct_ci_less_w); the tail-specific and overall empirical
non-coverage rates (pct_ci_miss_low, pct_ci_miss_high,
total_type_I_error), all proportions on the 0 to 1 scale; and
the input echoes (total_N, p, which_predictor,
true_b_j, estimated_b_j, width,
conf_level, and, when one was supplied, assurance). See
ss_aipe_reg_coef_sensitivity for the full row list.
Details
Direct specification of true_cov_YX and true_cov_XX is necessary, even if one is interested in
a single regression coefficient, so that the covariance/correlation structure can be specified when the simulation
within the function runs.
Note
Note that when the true and estimated covariance structures agree (true_cov_YX equals estimated_cov_YX and true_cov_XX equals estimated_cov_XX),
the results are not literally from a sensitivity analysis, rather the function performs a standard simulation
study. A simulation study can be helpful in order to determine if the sample size procedure
under or overestimates necessary sample size. See ss_aipe_reg_coef_sensitivity in DMAR for more details.
References
Kelley, K., & Maxwell, S. E. (2003). Sample size for multiple regression: Obtaining regression coefficients that are accurate, not simply significant. Psychological Methods, 8(3), 305–321. doi:10.1037/1082-989X.8.3.305
Maxwell, S. E., Delaney, H. D., & Kelley, K. (2027). Designing experiments and analyzing data: A model comparison perspective (4th ed.). Routledge. (See Chapter 4 on individual comparisons of means and Chapter 6 on trend analysis.)
See also
ss_aipe_reg_coef_sensitivity, ss_aipe_src_sensitivity, ss_aipe_reg_coef, ci_reg_coef
design_consequences for what a chosen design delivers:
power, the Type S (sign) and Type M (exaggeration) errors of the
significance filter, and the expected confidence interval width.
Author
Ken Kelley kkelley@nd.edu
Examples
# Sensitivity analysis for an unstandardized regression coefficient
# with two correlated predictors. G is kept small here so the example
# runs quickly; raise G for a stable Monte Carlo summary.
set.seed(113)
Sigma_X <- matrix(c(1, 0.3, 0.3, 1), nrow = 2)
rho_YX <- c(0.4, 0.3)
cov_YX <- rho_YX
ss_aipe_rc_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 = 20, print_iter = FALSE
)
#> term value
#> mean_b_j 0.337
#> median_b_j 0.332
#> sd_b_j 0.0428
#> mean_ci_width 0.195
#> median_ci_width 0.194
#> sd_ci_width 0.00901
#> pct_ci_less_w 0.65
#> pct_ci_miss_low 0
#> pct_ci_miss_high 0
#> total_type_I_error 0
#> mean_R2 0.199
#> median_R2 0.195
#> sd_R2 0.0361
#> total_N 346
#> p 2
#> which_predictor 1
#> true_b_j 0.341
#> estimated_b_j 0.341
#> width 0.2
#> conf_level 0.95
#>
#> Confidence level: 95%