Title: | Testing multiple biological mediators simultaneously |
---|---|
Description: | Implements methods for testing multiple mediators |
Authors: | Simina M. Boca, Ruth Heller, Joshua N. Sampson |
Maintainer: | Simina M. Boca <[email protected]> |
License: | GPL (>= 2) + file LICENSE |
Version: | 2.29.0 |
Built: | 2024-11-05 05:58:00 UTC |
Source: | https://github.com/bioc/MultiMed |
Implements Boca et al. 2014 method of testing multiple biological mediators simultaneously, which uses a permutation test with a joint correction based on the maximal test statistics.
medTest(E, M, Y, Z = NULL, useWeightsZ = TRUE, nperm = 100, w = 1)
medTest(E, M, Y, Z = NULL, useWeightsZ = TRUE, nperm = 100, w = 1)
E |
Exposure: numerical vector of length n or numerical n x 1 matrix, where n is the number of samples or subjects. |
M |
Mediators: numerical matrix of dimension n x p, where p is the number of mediators. |
Y |
Outcome: numerical vector of length n or numerical n x 1 matrix |
Z |
Additional covariates: NULL or numerical matrix having n rows. If it is not NULL, then the exposure, mediators, and outcome will all be initially regressed on Z, with the residuals being used in the mediation analysis. |
nperm |
Number of permutations performed. One of the permutations always consists of the observed data. |
w |
Weight assigned to each subject or sample for the E-M associations. Useful for case-control sampling. |
useWeightsZ |
If TRUE, use the weights in w for the initial regression of E and M on Z, in the case where Z is not null. If FALSE, use equal weights. |
See Boca et al. 2014 paper for a more in-depth description of this method.
Matrix with p rows and 2 columns, where the first column (labeled "S") gives the S-statistics and the second column (labeled "p") gives the p-values for each mediator, where the mediators correspond to the rows. For each mediator, the S-statistic is the absolute value of the product of the correlation between the exposure and the mediator and the conditional (or partial) correlation between the mediator and the outcome conditional on the exposure. Thus, the larger the S-statistic is, the smaller the p-value is, and the more likely it is that the mediator is statistically significant.
Simina M. Boca, Joshua N. Sampson
Boca SM, Sinha R, Cross AJ, Moore SC, Sampson JN. Testing multiple biological mediators simultaneously. Bioinformatics, 2014, 30(2), 214-220.
NavyAdenoma
##More details on this example are given in the accompanying vignette. data(NavyAdenoma) ##the exposure of interest is the daily intake of fish ##the possible mediators are 149 normalized serum metabolite values ##the outcome of interest is colorectal adenoma case-control status ##get weights needed due to retrospective sampling, to use for all regressions ##that do not have adenoma status as the outcome prev <- 0.228 p <- sum(NavyAdenoma$Adenoma==1)/nrow(NavyAdenoma) w <- rep(NA, nrow(NavyAdenoma)) w[NavyAdenoma$Adenoma == 1] <- prev/p w[NavyAdenoma$Adenoma == 0] <- (1-prev)/(1-p) ##perform the test of mediation, adjusting for the covariates ##BMI, gender, age, and current smoking status ##(only running 10 permutations in this example - would need to ##perform more to get an accurate p-value) set.seed(840218) medsFish <- medTest(E=NavyAdenoma$Fish, M=NavyAdenoma[, 6:154], Y=NavyAdenoma$Adenoma, Z=NavyAdenoma[, 2:5], nperm=10, w=w) ##get metabolite with lowest p-value medsFish[which.min(medsFish[,"p"]),] colnames(NavyAdenoma[,-(1:5)])[which.min(medsFish[,"p"])]
##More details on this example are given in the accompanying vignette. data(NavyAdenoma) ##the exposure of interest is the daily intake of fish ##the possible mediators are 149 normalized serum metabolite values ##the outcome of interest is colorectal adenoma case-control status ##get weights needed due to retrospective sampling, to use for all regressions ##that do not have adenoma status as the outcome prev <- 0.228 p <- sum(NavyAdenoma$Adenoma==1)/nrow(NavyAdenoma) w <- rep(NA, nrow(NavyAdenoma)) w[NavyAdenoma$Adenoma == 1] <- prev/p w[NavyAdenoma$Adenoma == 0] <- (1-prev)/(1-p) ##perform the test of mediation, adjusting for the covariates ##BMI, gender, age, and current smoking status ##(only running 10 permutations in this example - would need to ##perform more to get an accurate p-value) set.seed(840218) medsFish <- medTest(E=NavyAdenoma$Fish, M=NavyAdenoma[, 6:154], Y=NavyAdenoma$Adenoma, Z=NavyAdenoma[, 2:5], nperm=10, w=w) ##get metabolite with lowest p-value medsFish[which.min(medsFish[,"p"]),] colnames(NavyAdenoma[,-(1:5)])[which.min(medsFish[,"p"])]
Implements Heller/Sampson method of testing multiple biological mediators simultaneously, controlling either FWER or FDR.
medTest.SBMH(pEM,pMY,MCP.type="FWER",t1=0.05,t2=0.05,lambda=0)
medTest.SBMH(pEM,pMY,MCP.type="FWER",t1=0.05,t2=0.05,lambda=0)
pEM |
Vector of size m (where m = number of mediators). Entries are the p-values for the E,M_j relationship. |
pMY |
Vector of size m (where m = number of mediators). Entries are the p-values for the M_j,Y|E relationship. |
MCP.type |
Multiple comparison procedure - either "FWER" or "FDR". |
t1 |
Threshold for determining the cutoff to be one of the top S_1 E/M_j relationships. |
t2 |
Threshold for determining the cutoff to be one of the top S_2 M_j/Y relationships. |
lambda |
Threshold for estimating the proportion of false positives. |
See Heller/Sampson paper for a more in-depth description of this method.
m x 1 matrix of either p-values (if MCP.type = "FWER") or q-values (if MCP.type = "FDR").
Ruth Heller, Joshua N. Sampson
Sampson JN, Boca SM, Moore SC, Heller R. FWER and FDR control when testing multiple mediators. Bioinformatics, 2018, 34(14), 2418-2424.
##load dataset - details are given in the accompanying vignette data(NavyAdenoma) ##the exposure of interest is the daily intake of fish ##the possible mediators are 149 normalized serum metabolite values ##the outcome of interest is colorectal adenoma case-control status ##get all metabolites metabs <- colnames(NavyAdenoma)[6:154] ##get exposure/mediator relationships pEM <- sapply(NavyAdenoma[,metabs], function(m,e){coef(summary(lm(m ~ e)))[2,4]}, e=NavyAdenoma$Fish) ##get mediator/outcome relationship (conditional on exposure) pMY <- sapply(NavyAdenoma[,metabs], function(m,y,e){coef(summary(glm(y ~ m + e, family=binomial)))[2,4]}, y=NavyAdenoma$Adenoma, e=NavyAdenoma$Fish) ##perform mediation test for both FWER and FDR procedures medTest.FWER <- medTest.SBMH(pEM, pMY, MCP.type="FWER") ##get smallest p-value and corresponding metabolite min(medTest.FWER) metabs[which.min(medTest.FWER)] medTest.FDR <- medTest.SBMH(pEM, pMY, MCP.type="FDR") ##get smallest p-value and corresponding metabolite min(medTest.FDR) metabs[which.min(medTest.FDR)]
##load dataset - details are given in the accompanying vignette data(NavyAdenoma) ##the exposure of interest is the daily intake of fish ##the possible mediators are 149 normalized serum metabolite values ##the outcome of interest is colorectal adenoma case-control status ##get all metabolites metabs <- colnames(NavyAdenoma)[6:154] ##get exposure/mediator relationships pEM <- sapply(NavyAdenoma[,metabs], function(m,e){coef(summary(lm(m ~ e)))[2,4]}, e=NavyAdenoma$Fish) ##get mediator/outcome relationship (conditional on exposure) pMY <- sapply(NavyAdenoma[,metabs], function(m,y,e){coef(summary(glm(y ~ m + e, family=binomial)))[2,4]}, y=NavyAdenoma$Adenoma, e=NavyAdenoma$Fish) ##perform mediation test for both FWER and FDR procedures medTest.FWER <- medTest.SBMH(pEM, pMY, MCP.type="FWER") ##get smallest p-value and corresponding metabolite min(medTest.FWER) metabs[which.min(medTest.FWER)] medTest.FDR <- medTest.SBMH(pEM, pMY, MCP.type="FDR") ##get smallest p-value and corresponding metabolite min(medTest.FDR) metabs[which.min(medTest.FDR)]