Skip to contents

This function allows to calculate the critical correlation value. When using test = "t", the critical value is calculated assuming a Student t distribution with \(n - 2\) degrees of freedom and the standard error calculated using the raw correlation coefficient. When test = "z", the critical value is calculated assimong a standard Normal distribution and the standard error is calculated applying the Fisher's z transformation.

Usage

critical_cor(
  r = NULL,
  n,
  conf.level = 0.95,
  hypothesis = c("two.sided", "greater", "less"),
  test = c("t", "z")
)

Arguments

r

a number corresponding to the correlation coefficient.

n

a number corresponding to the sample size.

conf.level

the confidence level to set the confidence interval, default is set to 0.95.

hypothesis

a character string indicating the alternative hypothesis ("less", "greater" or "two.tailed").

test

a parameter to specify which test to apply, either "t" for a t-test or "z" for a z-test.

Value

rc is the critical correlation value, rzc is the Fisher's z transformed critical correlation, df are the degrees of freedom, se_r is the standard error of the observed correlation, se_rc is the standard error of the critical correlation, se_rzc is the standard error of the Fisher's z transformed critical correlation and test is the statistical test (either t or z).

Examples

# critical value from r and sample size
r <- .25
n <- 30
critical_cor(r = r, n = n )
#> $rc
#> [1] 0.3610069
#> 
#> $rzc
#> [1] NA
#> 
#> $df
#> [1] 28
#> 
#> $se_r
#> [1] 0.1829813
#> 
#> $se_rc
#> [1] 0.1762379
#> 
#> $se_rzc
#> [1] NA
#> 
#> $test
#> [1] "t"
#>