test_r {Keng}R Documentation

Test r using the t-test and Fisher's z given r and n.

Description

Test r using the t-test and Fisher's z given r and n.

Usage

test_r(r, n)

Arguments

r

Pearson's correlation.

n

Sample size of r.

Details

To test the significance of the r using one-sample t-test, the SE of the r is determined by the following formula: SE = sqrt((1 - r^2)/(n - 2)). Another way is transforming r to Fisher's z using the following formula: fz = atanh(r) with the SE of fz being sqrt(n - 3). Note that Fisher's z is commonly used to compare two Pearson's correlations from independent samples. Fisher's transformation is presented here only for satisfying the curiosity of users interested in the difference of t -test and Fisher's transformation.

Value

A list including r, t -test of r (SE_r, t, p_r), 95% CI of r based on t -test (LLCI_r_t, ULCI_r_t), fz (Fisher's z) of r, z -test of Fisher's z (SE_fz, z, p_fz), and 95% CI of r derived from fz. Note that the returned CI of r may be out of r's valid range [-1, 1]. This "error" is deliberately left to users, who should correct the CI manually when reporting.

Examples

test_r(0.2, 193)

# compare the p-values of t-test and Fisher's transformation
for (i in seq(30, 200, 10)) {
cat(c(
      "n =", i, ",",
       format(
        abs(test_r(0.2, i)[[1]][4] - test_r(0.2, i)[[2]][4]),
        nsmall = 12, scientific = FALSE)),
    fill = TRUE)
}

[Package Keng version 2024.11.25 Index]