# 1. Covariance structure path: supply the population correlation
# matrix and the population YX cross-correlations. Five predictors
# in an exchangeable structure (all pairwise correlations 0.5,
# all Y-X correlations 0.3).
rho_YX <- c(.3, .3, .3, .3, .3)
rho_XX <- rbind(c(1, .5, .5, .5, .5), c(.5, 1, .5, .5, .5),
c(.5, .5, 1, .5, .5), c(.5, .5, .5, 1, .5),
c(.5, .5, .5, .5, 1))
# Closed-form (central t) planning, targeting the first predictor's
# standardized coefficient.
ss_aipe_reg_coef(width = .10, which_width = "Full",
sigma_Y = 1, sigma_X = 1,
rho_XX = rho_XX, rho_YX = rho_YX,
which_predictor = 1, noncentral = FALSE,
conf_level = .95)
# Adding assurance (.85): the realized CI width will be no larger than
# 0.10 in 85 percent of replications. Required N grows accordingly.
ss_aipe_reg_coef(width = .10, which_width = "Full",
sigma_Y = 1, sigma_X = 1,
rho_XX = rho_XX, rho_YX = rho_YX,
which_predictor = 1, noncentral = FALSE,
conf_level = .95, assurance = .85)
# Exact noncentral t planning. Required N differs at small to
# moderate samples.
ss_aipe_reg_coef(width = .10, which_width = "Full",
sigma_Y = 1, sigma_X = 1,
rho_XX = rho_XX, rho_YX = rho_YX,
which_predictor = 1, noncentral = TRUE,
conf_level = .95)
# 2. Squared multiple correlations path: when the user has planning
# values for rho^2_Y.X and rho^2_j.X_-j directly (e.g., from a
# prior power analysis), without specifying the full covariance
# structure. b_j is required on this path.
ss_aipe_reg_coef(rho2_Y_X = 0.30, rho2_j_X_without_j = 0.20,
p = 5, b_j = 0.25,
width = .15, which_width = "Full",
sigma_Y = 1, sigma_X = 1,
noncentral = FALSE, conf_level = .95)
Run the code above in your browser using DataLab