Learn R Programming

DMAR (version 1.0.0)

ss_aipe_rc_sensitivity: Sensitivity Analysis for Sample Size Planning From the Accuracy in Parameter Estimation Perspective for the Unstandardized Regression Coefficient

Description

Performs 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,
  filename = NULL
)

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.

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 TRUE or FALSE statement whether or not the noncentral approach to sample size planning should be used

standardize

specify with a TRUE or FALSE statement whether or not the regression coefficient will be standardized; default is FALSE

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/FALSE statement if the iteration number should be printed as the simulation within the function runs

filename

Optional path for a comma separated file recording every replication, forwarded to ss_aipe_reg_coef_sensitivity, which does the writing: nothing is written when filename is NULL (the default), and a throwaway run should point it at tempfile(fileext = ".csv").

Author

Ken Kelley [email protected]

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.

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. tools:::Rd_expr_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.

Examples

Run this code
# 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
)

Run the code above in your browser using DataLab