Computes the sample size required to test a Pearson or a partial correlation with desired power. Set s = 0 for a Pearson correlation.
size.test.cor(alpha, pow, cor, s, h)
alpha level for hypothesis test
desired power
planning value of correlation
number of control variables
hypothesized value of correlation
Returns the required sample size
size.test.cor(.05, .9, .45, 0, 0)
#> Sample size
#> [1,] 48
# Should return:
# Sample size
# [1,] 48