gpuCor: Calculate Various Correlation Coefficients With a GPU

Description Usage Arguments Value See Also Examples

View source: R/gpuCor.R

Description

The correlation coefficient will be calculated for each pair $x_i$, $y_j$ where $x_i$ is a column of $x$ and $y_j$ is a column of $y$. Currently, Pearson's and Kendall's correlation coefficient are implemented. Pearson's may be calculated for data sets containing NAs in which case, the implementation behaves as R-native cor function with use="pairwise.complete".

Usage

1
gpuCor(x, y = NULL, use = "everything", method = "pearson")

Arguments

x

a matrix of floating point values in which each column is a random variable.

y

a matrix of floating point values in which each column is a random variable.

use

a string. A character string giving a method for computing in the presence of missing values. Options are "everything" or "pairwise.complete.obs". This currently only affects the "pearson" method.

method

a string. Either "pearson" or "kendall".

Value

For method "pearson", a list with matrices 'pairs', 'coefficients', and 'ts'. The matrix entry $i$, $j$ for pairs represents the number of pairs of entries $x_i^k$, $y_j^k$ (the $k$-th entry from $x_i$ and $y_j$ respectively). These are the number of entries actually used to calculate the coefficients. Entry $i$, $j$ of the coefficients matrix is the correlation coefficient for $x_i$, $y_j$. Entry $i$, $j$ of the ts matrix is the t-score of the $i$, $j$ entry of the coefficient matrix. If use="pairwise.complete.obs" then only the pairs where both entries are not NA are used in the computations.

For method "kendall", a list of matrices 'pairs' as above and 'coefficients' as follows. The matrix 'coefficients' is a matrix of floating point numbers where entry $i$, $j$ is the correlation coefficient for $x_i$, $y_j$. Calculation of t-scores for the kendall coefficients is not yet implemented.

See Also

cor

Examples

1
2
3
4
5
6
7
8
9
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")
A[3,2] <- NA
gpuCor(A, B, use="pairwise.complete.obs", method="pearson")

gputools documentation built on May 30, 2017, 1:52 a.m.

Related to gpuCor in gputools...