View source: R/MODULE_5_TER_ALT.R
meta_test | R Documentation |
Function to combine the output of related tests in a meta-analytical framework.
meta_test(x, features_equivar = FALSE, comp_sym = FALSE, effect_wt = TRUE, feature_list = NULL, long_output = FALSE)
x |
A list of test results to be combined. Each element of the list is a four-column matrix:
[1] beta (regression coefficient or any other measures of effect size) [2] sd.beta (standard deviation of beta),
[3] z (the test statistic from which original test p-values were calculated) [4] p (original test p-value).
In the Ribolog pipeline, it is produced by the |
features_equivar |
Method used to calculate the correlation matrix among test statistics of the tests that are being combined. FALSE: The correlation matrix on the provided vectors of test statistics is calculated as is. Features (genes, transcripts, etc) with higher variability of results among tests will the correlation matrix more. TRUE: row-normalize the test statistics first, so that the feature-wise e.g. gene-wise variance of z's for all features = 1. All features contribute equally to the correlation matrix. Deafult: FALSE. |
comp_sym |
Compound symmetry. TRUE: All pairs of tests are assumed to be equally correlated. If more than two tests are being combined, all pairwise correlation coefficients are replaced by a common value (more in Details). FALSE: Correlation matrix is calculated by the R default i.e. separately between each pair of z vectors. This would be equivalent to unstructured covariance matrix in repreated measure ANOVA. Default: FALSE. |
feature_list |
(Optional) A vector containing IDs of genes/transcripts. Must have the same length as the row number of input list data frames. |
long_output |
Indicates whether the parameters M and nu of the Makambi method should be included in the output. Default: FALSE. |
wt_effects |
Indicator variable. TRUE: Combine effect sizes weighted by their inverse of variance. FALSE: Combine effect sizes with equal weights. Default: TRUE. |
The columns in x
do not need to be named exactly as mentioned in parameter description, but they must be
in that exact order. They must all be given, too. The combination of test results cannot be done with p-values alone,
because p-values do not contain information on the direction of the effect, and thus, cannot be used to calculate correlation
between tests. Correlation among tests is calculated from z scores, not p-values. The vector of tests statistics should
preferably come directly from the original test. But, many software tools report only a measure of
effect size and the p-value, and omit SDs or test statistics from the output for the sake of brevity. If the p-value was calculated
using a Wald test (estimated parameter divided by its SD and compared against the standard normal distribution), use the function
add_sd_z
to reproduce the SD and z score columns, and then feed into meta_test
. SD is used by
meta_test
to calculate weights which is made to proprtional to the inverse of variance. If other measures of weights
are desired, manualy substitute the SD column in x
with inverse square roots of relative weights. If you want to give all
samples equal weight regardless of estimation uncertainty (not recommended), replace the SD column with a vector of 1s.
Compound symmetry is a covariance structure encountered in repeated measure ANOVA i.e. when a quantity is measured multiple times on each subject. In meta-analysis, we are measuring the association test statistic, e.g. z score from regression, multiple times for each transcript. Compound symmetry assumes a common error variance for all measurements, and a common covariance between all pairs of measurements on the same subject. This leads to equal correlation between all pairs of measurements on the same subject. In meta-analysis, this translates to equal correlation of all the tests that are being combined. If this option is selected, a common correlation coefficient will be estimated that best describes the average similarity between all pairs of z vectors.
Note that the meta_test
function is designed to combined tests on one predictor variable at a time. Ribolog and
some other bioanalytic tools can incorporate several predictors in one model. Also, models usually include an intercept term.
Results (the four previously described columns) for each predictor have to be extracted from the logit_seq
output
and combined separately using meta_test
.
A two or four column matrix. By default, a two column matrix: [1] meta_beta: combined effect size [2] meta_p: combined p-value.
If long_output = TRUE
is specified, a four columns matrix: [1] meta_beta: combined effect size [2] M [3] nu
[4] meta_p: combined p-value. M
is the meta-analysis test statistic. A derivative of M
follows a chi-squared distribution
with nu
degrees of freedom.
Makambi, K. 2003. Weighted inverse chi-square method for correlated significance tests. Journal of Applied Statistics, 30(2): 225-234.
The effect of lung metastasis is tested in two genetic backgrounds sperately, then combined: fit1a_LMCN <- Ribolog::logit_seq(rr_LMCN.v2[,c(2:5,10:13)], sample_attributes_LMCN[c(1:4,9:12), ], read_type ~ lung_metastasis, as.vector(rr_LMCN.v2$transcript)) fit1b_LMCN <- Ribolog::logit_seq(rr_LMCN.v2[,c(6:9,14:17)], sample_attributes_LMCN[c(5:8,13:16), ], read_type ~ lung_metastasis, as.vector(rr_LMCN.v2$transcript)) We are not interested in the intercept terms, so keep only the last four columns of the outputs which pertain to lung metastasis: fit1ab_LMCN_list <- list("fit1a_LMCN" = fit1a_LMCN[, c(5:8)], "fit1b_LMCN" = fit1b_LMCN[, c(5:8)]) And now, combine: fit1ab_LMCN_meta <- meta_test(fit1ab_LMCN_list, feature_list = rr_LMCN.v2$transcript)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.