Learn R Programming

DMAR (version 1.0.0)

ss_power_r: Sample Size or Power for a Pearson Correlation Coefficient (Fisher Z Transformation)

Description

Determine the necessary sample size to achieve a desired level of statistical power for the test of a Pearson correlation against a null value (typically zero), or, given a sample size, return the realized statistical power. The computation uses the Fisher's Z transformation, which has a near-normal sampling distribution.

Usage

ss_power_r(
  rho,
  rho_0 = 0,
  desired_power = 0.85,
  alpha_level = 0.05,
  N = NULL,
  directional = FALSE
)

Value

A data.frame with rows for necessary_N (or specified_N),

actual_power, rho, and rho_0.

Arguments

rho

The population correlation coefficient under the alternative hypothesis

rho_0

The null hypothesis value of the correlation (default 0)

desired_power

Desired statistical power (default 0.85)

alpha_level

Type I error rate (default 0.05)

N

Sample size (number of pairs); if specified, returns the realized power (the ss_power_* family is not uniform here: ss_power_contrast takes a per-group size)

directional

Logical: TRUE for a one-sided test (in the same direction as the difference rho - rho_0), FALSE (default) for a two-sided test

Author

Ken Kelley [email protected]

Details

Under the alternative the Fisher-transformed correlation \(Z_r = \tanh^{-1}(r)\) is approximately normal with mean \(Z_\rho = \tanh^{-1}(\rho)\) and variance \(1 / (N - 3)\). Power is computed from this normal approximation.

For sample size, a closed-form expression is used as the starting point, $$N = ((z_{\alpha} + z_{\beta}) / (Z_\rho - Z_{\rho_0}))^2 + 3,$$ which is then verified iteratively to ensure power exactly meets or exceeds desired_power. The search is bounded at \(N = 10^7\). When rho and rho_0 are so close that desired_power is unreachable within that bound, the function stops with an error rather than searching indefinitely.

References

Cohen, J. (1988). Statistical power analysis for the behavioral sciences (2nd ed.). Hillsdale, NJ: Lawrence Erlbaum.

Fisher, R. A. (1921). On the "probable error" of a coefficient of correlation deduced from a small sample. Metron, 1, 3--32.

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 3 on the one-way ANOVA and Chapter 4 on contrasts.)

See Also

ci_r, convert_r_Z, convert_Z_r

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.

Other sample size for power: power_fisher_exact(), ss_aipe_mixed_effects(), ss_power_R2(), ss_power_R2_sensitivity(), ss_power_c(), ss_power_c_ancova(), ss_power_composite_ancova(), ss_power_composite_ancova_2group(), ss_power_composite_anova(), ss_power_composite_factorial_ancova(), ss_power_composite_factorial_ancova_het(), ss_power_composite_factorial_anova(), ss_power_composite_sem(), ss_power_contrast(), ss_power_equivalence_c(), ss_power_factorial_ancova(), ss_power_factorial_anova(), ss_power_indirect_effect(), ss_power_mixed_effects(), ss_power_one_way_anova(), ss_power_pcm(), ss_power_rc(), ss_power_reg_coef(), ss_power_reg_coef_sensitivity(), ss_power_rm_anova(), ss_power_sc(), ss_power_sem(), ss_power_smd(), ss_power_split_plot_anova()

Examples

Run this code
# Population r = 0.30, null r = 0, desired power = .80, two-sided
ss_power_r(rho = 0.30, desired_power = 0.80)

# Same with a directional alternative
ss_power_r(rho = 0.30, desired_power = 0.80, directional = TRUE)

# Realized power for N = 100 pairs
ss_power_r(rho = 0.30, N = 100)

# Test against a non-zero null (rho_0 = 0.20) -- looking for evidence rho > 0.20
ss_power_r(rho = 0.40, rho_0 = 0.20, desired_power = 0.80, directional = TRUE)

Run the code above in your browser using DataLab