check.column.order.input.MetaCor: Check that the input is organized in the right way for...

Description Usage Arguments Details Value Author(s) Examples

Description

The functions that compute the meta-analysis estimators from MetaCor family (corMeta.fixef, corMeta.GLS.1 and corMeta.GLS.invert.mats) assume a specific order on the input data, since they perform matrix operations. This function checks that the order is correct.

Usage

1

Arguments

beta

a p by s matrix of the estimated effects of each of p SNPs on a trait in each of s strata. It must have column names of the form "Beta.stratum_name"

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. It must have column names of the form "var.stratum_name"

cov

a p by (s*(s-1)/2) matrix of a vector of length p of covairances between the estimated effects of each of p SNPs on a trait in each of s strata.It must have column names of the form "cov.stratum_name_1:stratum_name_2"

Details

The order of the columns is automatically correct when this function is called by stratLMMTest. This function is important if the user is performing additional meta-analysis based on effect estimates, they variances and covariances.

Value

A list with a logical element named good.input (if TRUE, the columns are ordered correctly according to their names, otherwise it is FALSE). If good.input is FALSE, additional message is provided with the type of problem.

Author(s)

Tamar Sofer

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
### 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[upper.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")

## order is correct:
check.column.order.input.MetaCor(effects, vars, covs)

## we want to meta-analyzed only strata s1 and s2. Are we choosing them correctly?
check.column.order.input.MetaCor(effects[,1:2], vars[,1:2], covs[,1, drop = F])
## yes!

check.column.order.input.MetaCor(effects[,1:2], vars[,1:2], covs[,2, drop = F])
## no!

tamartsi/MetaCor documentation built on May 31, 2019, 2:56 a.m.