Cor.Mat <- rbind(
c(1.00, 0.53, 0.58, 0.60, 0.46, 0.66),
c(0.53, 1.00, 0.35, 0.07, 0.14, 0.43),
c(0.58, 0.35, 1.00, 0.18, 0.29, 0.50),
c(0.60, 0.07, 0.18, 1.00, 0.30, 0.26),
c(0.46, 0.14, 0.29, 0.30, 1.00, 0.30),
c(0.66, 0.43, 0.50, 0.26, 0.30, 1.00)
)
rho_XX <- Cor.Mat[2:6, 2:6]
rho_YX <- Cor.Mat[1, 2:6]
# Method 1
ss_power_reg_coef(rho2_Y_X = 0.7826786, rho2_Y_X_without_j = 0.7363697, p = 5,
alpha_level = .05, directional = FALSE, desired_power = .80)
# Method 2
ss_power_reg_coef(alpha_level = .05, rho_XX = rho_XX, rho_YX = rho_YX, which_predictor = 5,
directional = FALSE, desired_power = .80)
# Method 3
# Here, beta_j is the standardized regression coefficient. Had beta_j
# been the unstandardized regression coefficient, sigma_X and sigma_Y
# would have been the standard deviation for the X variable of
# interest and Y, respectively.
ss_power_reg_coef(rho2_Y_X = 0.7826786, rho2_j_X_without_j = 0.3652136, beta_j = 0.2700964,
p = 5, alpha_level = .05, sigma_X = 1, sigma_Y = 1, directional = FALSE,
desired_power = .80)
# Method 4
ss_power_reg_coef(alpha_level = .05, cohen_f2 = 0.2130898, p = 5,
directional = FALSE, desired_power = .80)
# Power given a specified N and squared multiple correlation coefficients.
ss_power_reg_coef(rho2_Y_X = 0.7826786, rho2_Y_X_without_j = 0.7363697, specified_N = 25,
p = 5, alpha_level = .05, directional = FALSE)
# Power given a specified N and effect size.
ss_power_reg_coef(alpha_level = .05, cohen_f2 = 0.2130898, p = 5, specified_N = 25,
directional = FALSE)
# Reproducing Maxwell's (2000, p. 445) Example
Cor.Mat.Maxwell <- rbind(
c(1.00, 0.35, 0.20, 0.20, 0.20, 0.20),
c(0.35, 1.00, 0.40, 0.40, 0.40, 0.40),
c(0.20, 0.40, 1.00, 0.45, 0.45, 0.45),
c(0.20, 0.40, 0.45, 1.00, 0.45, 0.45),
c(0.20, 0.40, 0.45, 0.45, 1.00, 0.45),
c(0.20, 0.40, 0.45, 0.45, 0.45, 1.00)
)
RHO.XX.Maxwell <- Cor.Mat.Maxwell[2:6, 2:6]
Rho.YX.Maxwell <- Cor.Mat.Maxwell[1, 2:6]
R2.Maxwell <- Rho.YX.Maxwell %*% solve(RHO.XX.Maxwell) %*% Rho.YX.Maxwell
RHO.XX.Maxwell.no.1 <- Cor.Mat.Maxwell[3:6, 3:6]
Rho.YX.Maxwell.no.1 <- Cor.Mat.Maxwell[1, 3:6]
R2.Maxwell.no.1 <-
Rho.YX.Maxwell.no.1 %*% solve(RHO.XX.Maxwell.no.1) %*% Rho.YX.Maxwell.no.1
# This procedure arrives at N = 111, whereas Maxwell (2000, p. 445)
# reports N = 113. The two differ because of the noncentrality
# parameterization, not rounding: this function uses the fixed-predictor
# noncentrality sqrt(N) * f (see Details), while the tabled value rests on
# Cohen's (1988) convention. Neither is a random-predictor result; under
# random predictors, where the predictor values vary across replications,
# the sample size needed for the same power is larger still.
ss_power_reg_coef(rho2_Y_X = R2.Maxwell, rho2_Y_X_without_j = R2.Maxwell.no.1, p = 5,
alpha_level = .05, directional = FALSE, desired_power = .80)
Run the code above in your browser using DataLab