Learn R Programming

genefu (version 2.4.2)

cordiff.dep: Function to estimate whether two dependent correlations differ

Description

This function tests for statistical differences between two dependent correlations using the formula provided on page 56 of Cohen & Cohen (1983). The function returns a t-value, the DF and the p-value.

Usage

cordiff.dep(r.x1y, r.x2y, r.x1x2, n,
  alternative = c("two.sided", "less", "greater"))

Arguments

r.x1y
The correlation between x1 and y where y is typically your outcome variable.
r.x2y
The correlation between x2 and y where y is typically your outcome variable.
r.x1x2
The correlation between x1 and x2 (the correlation between your two predictors).
n
The sample size.
alternative
A character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less". You can specify just the initial letter.

Value

  • Vector of three values: t statistics, degree of freedom, and p-value.

Details

This function is inspired from the cordif.dep.

References

Cohen, J. & Cohen, P. (1983) "Applied multiple regression/correlation analysis for the behavioral sciences (2nd Ed.)" Hillsdale, nJ: Lawrence Erlbaum Associates.

See Also

cor, t.test, compare.proto.cor

Examples

Run this code
## load VDX dataset
data(vdxs)
## retrieve ESR1, AURKA and MKI67 gene expressions
x1 <- data.vdxs[ ,"208079_s_at"]
x2 <- data.vdxs[ ,"205225_at"]
y <- data.vdxs[ ,"212022_s_at"]
## is MKI67 significantly more correlated to AURKA than ESR1?
cc.ix <- complete.cases(x1, x2, y)
cordiff.dep(r.x1y=abs(cor(x=x1[cc.ix], y=y[cc.ix], use="everything",
  method="pearson")), r.x2y=abs(cor(x=x2[cc.ix], y=y[cc.ix],
  use="everything", method="pearson")), r.x1x2=abs(cor(x=x1[cc.ix],
  y=x2[cc.ix], use="everything", method="pearson")), n=sum(cc.ix),
  alternative="greater")

Run the code above in your browser using DataLab