Computes a t test for a test of the null hypothesis that a population Pearson or partial correlations is equal to 0, or a z test using a Fisher transformation for a test of the null hypothesis that a Pearson or partial correlation is equal to some specified nonzero value. Set s = 0 for a Pearson correlation. The hypothesis testing results should be accompanied with a confidence interval for the population Pearson or partial correlation value.
test.cor(cor, n, s, h)
estimated correlation
sample size
number of control variables
null hypothesis value of correlation
Returns a 1-row matrix. The columns are:
Estimate - estimate of correlation
t or z - t test statistic (for h = 0) or z test statistic
p - two-sided p-value
test.cor(.484, 100, 0, .2)
#> Estimate z p
#> 0.484 3.205432 0.001348601
# Should return:
# Estimate z p
# 0.484 3.205432 0.001348601
test.cor(.372, 100, 0, 0)
#> Estimate t df p
#> 0.372 3.967337 98 0.000138436
# Should return:
# Estimate t df p
# 0.372 3.967337 98 0.000138436