r_crit: Critical Value for Correlation Coefficient

View source: R/r_crit.R

r_critR Documentation

Critical Value for Correlation Coefficient

Description

Calculate critical value for correlation coefficient, for a given sample size and confidence level. If absolute value of an observed correlation coefficient is higher than the critical value, then the correlation is statistically significant with the specified confidence. This approach is identical to using textbook tables of critical values and alternative to calculating p-values.

Usage

r_crit(n, conf.level = 0.95, method = c("t"))

Arguments

n

sample size(s) used to calculate correlations. Values of n < 4 are omitted.

conf.level

confidence level for calculating the critical value(s). Default is 0.95 (i.e., confidence of 95%). If length of the input is higher than 1, only the first element is used.

method

Method for calculating the critical values. Currently only the method based on t-distribution is used.

Details

Using Student's t-distribution, the critical value is

r_{crit} = \frac{t}{\sqrt{n - 2 + t^2}},

where t is a quantile of t-distribution with n - 2 degrees of freedom for probability 1 - (1 - conf.level)/2.

Value

A vector of critical values.

Author(s)

Vyacheslav Lyubchich

References

\insertAllCited

See Also

cor.test, cor

Examples

r_crit(120)
r_crit(20:30, conf.level = 0.9)


vlyubchich/funtimes documentation built on May 6, 2023, 3:21 a.m.