GHC: GHC.R

Description Usage Arguments Value Examples

View source: R/GHC.R

Description

Calculate the Generalized Higher Criticism test statistic and p-value.

Usage

1
GHC(test_stats, cor_mat = NULL, pairwise_cors = NULL)

Arguments

test_stats

Vector of test statistics for each factor in the set (i.e. marginal test statistic for each SNP in a gene).

cor_mat

d*d matrix of the correlations between all the test statistics in the set, where d is the total number of test statistics in the set. You only need to specify EITHER cor_mat OR pairwise_cors.

pairwise_cors

A vector of all d(d-1)/2 pairwise correlations between the test statistics. You only need to specify EITHER cor_mat OR pairwise_cors.

Value

A list with the elements:

GHC

The observed Generalized Higher Criticism test statistic.

GHC_pvalue

The p-value of this observed value, given the size of the set and correlation structure.

err_code

Sometimes if your p-value is very small (<10^(-12) usually), R/C++ do not have enough precision in their standard routines to calculate the number accurately. In these cases (and very rarely others) we switch to standard Higher Criticism instead (more stable numerically) and let you know with a message here.

Examples

1
2
3
4
5
set.seed(100)
Z_vec <- rnorm(5)
cor_Z <- matrix(data=0.2, nrow=5, ncol=5)
diag(cor_Z) <- 1
GHC(test_stats=Z_vec, cor_mat=cor_Z)

Example output

$GHC
[1] 0.5777352

$GHC_pvalue
[1] 0.8910812

$err_code
[1] 0

GBJ documentation built on March 26, 2020, 6:05 p.m.