Description Usage Arguments Value Author(s) Examples
Calculates the modified Cochran's Q test for heterogeneity between effect estimates, while accounting for correlations between the effect estimates.
1 | cochran.Q.cor.1(beta.1, var.1, cov.1, testType)
|
beta.1 |
A vector of S effect estimates |
var.1 |
A vector of S variances of the effect estimates in beta.1 |
cov.1 |
A vector of S*(S-1)/2 covariances between the effect estimates in beta.1 |
testType |
Which test should the Cochran Q test be based on? MetaCor.fixef (MetaCor1), or MetaGLS (MetaCor2)? preferably, one should use the same testType that was used to compute the meta-analysis estimator. |
A p-value of the test of heterogeneity.
Tamar Sofer
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | 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")
cochran.Q.cor.1(effects[1,], vars[1,], covs[1,], testType = "MetaGLS")
cochran.Q.cor.1(effects[1,], vars[1,], covs[1,], testType = "MetaCor.fixef")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.