Calculates the effective number of tests performed in a GWAS, given the LD structure among the SNPs. SNPs that are highly correlated are not counted twice.

eff_nbr_tests(mat, cor.true = FALSE)

Arguments

mat

matrix, either individual by SNPs (n x p) matrix, or correlation matrix between SNPs

cor.true

indicates if option mat is a correlation matrix or not

Value

zhc.correction number of effective tests

References

Implemented from https://www.ncbi.nlm.nih.gov/pubmed/18271029

Examples

dat.sim <- data.frame(g = rnorm(100)) %>% dplyr::mutate(g2 = g * 2) eff_nbr_tests(diag(10), cor.true = TRUE) ## 10, because all are independent
#> [1] 10
eff_nbr_tests(dat.sim, cor.true = FALSE)
#> [1] 1