Description Usage Arguments Details Value Note Author(s) Examples
Computes the fixed effects meta-analysis estimator while accounting for correlations between effect estimates in the variance estimation. The computation is done for many SNPs at a time using matrix operations, including inversion of many matrices at once.
1 |
beta |
a p by S matrix of estimated effects of each of p SNPs on a trait in each of S strata. |
var |
a p by S matrix of variances of the estimated effects of each of p SNPs on a trait in each of S strata. |
cov |
a p by (S*(S-1)/2) matrix representing p vectors of covariances between the estimated effects of each of p SNPs on a trait in each of S strata. |
Computes the MetaGLS (MetaCor1 form the MetaCor paper) estimator and test. This function can be memory intensive since it inverts many matrices together, in recurssion. Don't use for more than 6 strata.
A data frame with p rows, with beta, var, test.stat and pval providing the meta-analysis effect estimates, their variances, test statistics, and p-values for each of the SNPs. beta, cov and var should have appropriate column names.
This function is called by MetaCor and it is advisable to use MetaCor. It can also be called directly, but then the test of heterogeneity is not performed. Also, MetaCor allows for selection of strata while this function does not.
Tamar Sofer
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | ### create a small data set with the right formating:
require(mvtnorm)
n.strat <- 5
n.est <- 5
## create a positive definite matrix to be a covariance matrix
sigma <- matrix(rnorm(n.strat^2), n.strat, n.strat)
sigma <- t(sigma)
effects <- rmvnorm(n.est, c(2,2,3,3,0), sigma)
colnames(effects) <- paste0("Beta.s", 1:n.strat)
vars <- matrix(rep(diag(sigma), n.est), nrow = n.est, ncol = n.strat, byrow = T)
colnames(vars) <- paste0("var.s", 1:n.strat)
covs <- matrix(rep(sigma[lower.tri(sigma)], n.est), nrow = n.est, byrow = T)
colnames(covs) <- c(paste0("cov.s1:", paste0("s", 2:n.strat)), paste0("cov.s2:", paste0("s", 3:n.strat)), paste0("cov.s3:", paste0("s", 4:n.strat)) , "cov.s4:s5")
## test:
corMeta.GLS.invert.mats(effects, vars, covs)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.