comptest.cor: Comparision of product-moment correlation coefficients In miscor: Miscellaneous Functions for the Correlation Coefficient

Description

This function statistically compares product-moment correlation coefficients in independent and dependent samples.

Usage

 ```1 2 3 4 5``` ```comptest.cor(x = NULL, y = NULL, z = NULL, group = NULL, r.xy = NULL, r.xz = NULL, r.yz = NULL, n = NULL, r.1 = NULL, r.2 = NULL, n.1 = NULL, n.2 = NULL, alternative = c("two.sided", "less", "greater"), conf.level = 0.95, digits = 3, output = TRUE) ```

Arguments

 `x` a numeric vector. `y` a numeric vector. `z` a numeric vector. `group` a numeric vector indiating the group membership. `r.xy` alternative specification, product-moment correlation coefficient between `x` and `y`. `r.xz` alternative specification, product-moment correlation coefficient between `x` and `z`. `r.yz` alternative specification, product-moment correlation coefficient between `y` and `z`. `n` alternative specification, number of observations. `r.1` alternative specification, product-moment correlation coefficient in group 1. `r.2` alternative specification, product-moment correlation coefficient in group 2. `n.1` alternative specification, number of observations in group 1. `n.2` alternative specification, number of observations in group 2. `alternative` a character string describing the alternative hypothesis, must be one of `"two.sided"` (default), `"greater"` or `"less"`. `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

In dependent samples, the function tests the two-sided null hypothesis H0: ρ .xy = ρ .xz or the one-sided null hypothesis H0: ρ .xy >= ρ .xz or ρ .xy <= ρ .xz. Function parameters are specified using either (`x`, `y`, `z`) or (`r.xy`, `r.xz`, `r.yz`, `n`). In independent samples, the function tests the two-sided null hypothesis H0: ρ.1 = ρ.2 or the one-sided null hypothesis H0: ρ.1 >= ρ.2 or ρ.1 <= ρ.2. Function parameters are specified using either (`x`, `y`, `group`) or (`r.1`, `r.2`, `n.1`, `n.2`).

Value

Returns an object of class `comptest.cor` with following entries:

 `call` function call `dat` data.frame with x, y and z (if available) `spec` specification of function arguments `res` list with results depending on the analysis (independent of dependent samples), i.e., z (test statistic), pval (significance value), r.xy, r.xz, r.yz, r.1, r.2, diff (difference), n, n.1, n.1, lower (lower limit of CI), upper (upper limit of CI)

Author(s)

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

References

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

Zou, G. Y. (2007). Toward using confidence intervals to compare correlation. Psychological Methods, 12, 399-413.

`test.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 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40``` ```# Dependent samples: Generate random data x <- c(3, 2, 2, 3, 7, 8, 5, 9) y <- c(2, 4, 1, 5, 7, 3, 6, 7) z <- c(1, 4, 3, 3, 1, 4, 2, 5) #-------------------------------------- # Dependent samples # H0: rho.xy == rho.xz, H1: rho.xy != rho.xz comptest.cor(x, y, z) #-------------------------------------- # Dependent samples # H0: rho.xy <= rho.xz, H1: rho.xy > rho.xz # r.xy = 0.44, r.xz = 0.21. r.yz = 0.20, n = 120 comptest.cor(r.xy = 0.44, r.xz = 0.21, r.yz = 0.20, n = 120, alternative = "greater") ### # Independent samples: Generate random data dat <- data.frame(group = rep(1:2, each = 200), rbind(sim.cor(200, rho = 0.3), sim.cor(200, rho = 0.5))) #-------------------------------------- # Independent samples # H0: rho.1 == rho.2, H1: rho.1 != rho.2 comptest.cor(x = dat\$x, y = dat\$y, group = dat\$group) #-------------------------------------- # Independent samples # H0: rho.1 >= rho.2, H1: rho.1 ! < rho.2 # Group 1: r = 0.32, n = 108 # Group 2: r = 0.56, n = 113 comptest.cor(r.1 = 0.32, n.1 = 108, r.2 = 0.56, n.2 = 113, alternative = "less") ```