Description Usage Arguments Details Value Author(s) References See Also Examples
This function tests the product-moment correlation coefficient for H0: ρ = ρ0, so that any value for ρ0 can be specified.
1 2 3 |
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 |
reduced |
logical: if |
conf.level |
confidence level of the interval. |
digits |
integer indicating the number of decimal places to be displayed. |
output |
logical: if |
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.
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) |
Takuya Yanagida takuya.yanagida@univie.ac.at,
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.
size.cor
, comptest.cor
, seqtest.cor
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.