jtGWAS: Compute the Jonckheere-Terpstra Test Statistics

Description Usage Arguments Value Note References Examples

View source: R/jtGWAS.R

Description

A method to compute the Jonckheere-Terpstra test statistics for large numbers of dependent and independent variables, with optional multi-threaded execution. The calculation of the standardized test statistic employs the null variance equation as defined by Hollander and Wolfe (1999, eq. 6.19) to account for ties in the data.

Usage

1
  jtGWAS(X, G, outTopN=15L, numThreads=1L, standardized=TRUE)  	

Arguments

X

A matrix of dependent variables, e.g. marker levels. Row names are sample IDs, and column names are marker IDs. Required.

G

A matrix of independent variables, e.g. SNP counts. Row names are sample IDs, and column names are SNP IDs. Required.

outTopN

An integer to indicate the number of top hits to be reported for each marker, based on the standardized Jonckheere-Terpstra test statistics. Optional, and the default value is 15L. If set to NA, all results are returned.

numThreads

A integer to indicate the number of threads used in the computation. Optional, and the default value is 1L(sequential computation).

standardized

A boolean to specify whether to return standardized statistics (TRUE) or non-standardized statistics (FALSE). Optional, the default value is TRUE.

Value

A list with two objects

J

A matrix of the standardized/non-standardized Jonckheere-Terpstra test statistics, depending on the value of the standardized argument.

gSnipID

If outTopN was specified, this object is a matrix of the column IDs of G corresponding to the top standardized Jonckheere-Terpstra test statistics for each marker. Otherwise this is a vector of column IDs of G.

Note

Rows (samples) are assumed to be in the same order in X and G.

References

Hollander, M. and Wolfe, D. A. (1999) Nonparametric Statistical Methods. New York: Wiley, 2nd edition.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# Generate dummy data	
num_patient <- 100
num_marker 	<- 10
num_SNP     <- 500
set.seed(12345)
X_pat_mak <- matrix(rnorm(num_patient*num_marker), num_patient, num_marker)
G_pat_SNP <- matrix(rbinom(num_patient*num_SNP, 2, 0.5), num_patient, num_SNP)
colnames(X_pat_mak) <- colnames(X_pat_mak, do.NULL=FALSE, prefix="Mrk:")
colnames(G_pat_SNP) <- colnames(G_pat_SNP, do.NULL=FALSE, prefix="SNP:")

res <- jtGWAS(X_pat_mak, G_pat_SNP, outTopN=5)
res
res <- jtGWAS(X_pat_mak, G_pat_SNP, outTopN=NA)
head(res) 

jtGWAS documentation built on Aug. 15, 2017, 1:02 a.m.