test.cor: Test for the product-moment correlation coefficient for H0:...

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

This function tests the product-moment correlation coefficient for H0: ρ = ρ0, so that any value for ρ0 can be specified.

Usage

1
2
3
test.cor(x = NULL, y = NULL, r = NULL, n = NULL, rho0 = 0,
         alternative = c("two.sided", "less", "greater"), reduced = FALSE,
         conf.level = 0.95, digits = 3, output = TRUE)

Arguments

x

a numeric vector.

y

a numeric vector.

r

alternative specification, product-moment correlation coefficient.

n

alternative specification, number of observations.

rho0

a number indicating ρ0, the value under the null hypothesis.

alternative

a character string describing the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less".

reduced

logical: if TRUE, compuatation is based on the reduced formula.

conf.level

confidence level of the interval.

digits

integer indicating the number of decimal places to be displayed.

output

logical: if TRUE, output is shown.

Details

Computation is based on Fisher's z transformation \textbf{z} = 0.5 /cdot ln(\frac{1 + r}{1 - r}). The difference between the full formula (i.e., reduced = FALSE) and the reduced formula (i.e., reduced = TRUE) is that the full formula includes the term \frac{ρ}{n - 1} in the formula of the exectation E, i.e.,

\emph{E}(\textbf{z}) = 0.5 /cdot ln(\frac{1 + ρ}{1 - ρ}) + \frac{ρ}{n - 1}

whereas the reduced formula does not include this term, i.e.,

\emph{E}(\textbf{z}) = 0.5 /cdot ln(\frac{1 + ρ}{1 - ρ})

It is recommended to always use the full formula, especially in small samples.

Value

Returns an object of class test.cor with following entries:

call function call
dat data.frame with x and y (if available)
spec specification of function arguments
res list with results, i.e., t or z (test statistic), df (degree of feedom), pval (significance value), r (correlation coefficient), n (sample size), lower (lower limit of CI), upper (upper limit of CI)

Author(s)

Takuya Yanagida takuya.yanagida@univie.ac.at,

References

Cramer, H. (1946). Mathematical methods of statistics. Princeton: Princeton Press.

Rasch, D., Kubinger, K. D., & Yanagida, T. (2011). Statistics in psychology - Using R and SPSS. New York: John Wiley & Sons.

Kubinger, K. D., Rasch, D., & Simeckova, M. (2007). Testing a correlation coefficient's significance: Using H0: 0 < ρ ≤ λ is preferable to H0: ρ = 0. Psychology Science, 49, 74-87.

See Also

size.cor, comptest.cor, seqtest.cor

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
#--------------------------------------
# Two-sided test
# H0: rho == 0, H1: rho != 0
# r = 0.23, n = 60

test.cor(r = 0.23, n = 120)

#--------------------------------------
# Two-sided test
# H0: rho == 0.4, H1: rho != 0.4
# r = 0.55, n = 120

test.cor(r = 0.55, n = 120, rho0 = 0.4)

#--------------------------------------
# One-sided test
# H0: rho <= 0.4, H1: rho > 0.4

# Generate random data
dat <- sim.cor(100, rho = 0.4)

test.cor(dat$x, dat$y, rho0 = 0.4)

miscor documentation built on May 1, 2019, 10:14 p.m.

Related to test.cor in miscor...