| gpuCor | R Documentation |
Correlates each column of x with each column of y, as
cor does, with Pearson's, Kendall's (tau-b) or
Spearman's coefficient, and tests each correlation for zero, as
cor.test does.
gpuCor(x, y = NULL, use = "everything", method = "pearson",
test = FALSE, precision = getOption("gputools.precision", "single"))
x |
a numeric matrix whose columns are the variables. |
y |
a numeric matrix with the same number of rows, or |
use |
|
method |
|
test |
|
precision |
|
Kendall's coefficient is tau-b and Spearman's is Pearson's on the ranks,
ties averaged; with use = "pairwise.complete.obs", each pair is
ranked over its complete rows only. All three match cor.
The p-values are two-sided and match cor.test: exactly for
Pearson's (a t test on pairs - 2 degrees of freedom), and as
cor.test(exact = FALSE) gives them for Spearman's (the same t
approximation) and Kendall's (a normal approximation with the tie
correction). cor.test's exact small-sample tests for the rank
coefficients are not computed.
A list of matrices, each with a row per column of x and a column
per column of y, named as cor names them:
coefficients |
the correlations. |
ts |
for Pearson's and Spearman's, the t statistics,
|
z |
for Kendall's, with |
p.value |
with |
pairs |
the number of rows each correlation used. |
cor, cor.test
numAvars <- 5
numBvars <- 10
numSamples <- 30
A <- matrix(runif(numAvars*numSamples), numSamples, numAvars)
B <- matrix(runif(numBvars*numSamples), numSamples, numBvars)
gpuCor(A, B, method="pearson")
gpuCor(A, B, method="kendall")
gpuCor(A, B, method="spearman", test=TRUE)$p.value
A[3,2] <- NA
gpuCor(A, B, use="pairwise.complete.obs", method="pearson")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.