| Title: | Multivariable Mendelian randomization accounting for complex correlated horizontal pleiotropy while elucidating shared genetic etiology |
|---|---|
| Description: | Multivariable Mendelian randomization accounting for complex correlated horizontal pleiotropy while elucidating shared genetic etiology. |
| Authors: | Qing Cheng [aut, cre] (ORCID: <https://orcid.org/0000-0001-5144-4515>) |
| Maintainer: | Qing Cheng <[email protected]> |
| License: | GPL (>= 3) |
| Version: | 1.0 |
| Built: | 2026-05-15 09:44:48 UTC |
| Source: | https://github.com/remlapmot/MVMR.CUE |
Multivariable Mendelian randomization accounting for complex correlated horizontal pleiotropy while elucidating shared genetic etiology.
Qing Cheng [email protected]
Example summary statistics for multivariable Mendelian randomization, containing association estimates and standard errors for 200 genetic variants with two exposures and one outcome.
data(gamma1) data(Gamma2) data(se1) data(se2)data(gamma1) data(Gamma2) data(se1) data(se2)
gamma1A 200 x 2 matrix of SNP-exposure association estimates.
Gamma2A matrix of 200 SNP-outcome association estimates.
se1A 200 x 2 matrix of standard errors for SNP-exposure associations.
se2A matrix of 200 standard errors for SNP-outcome associations.
Simulates SNP genotype data with a specified minor allele frequency range and correlation structure.
genRaw(L, M, rho, n)genRaw(L, M, rho, n)
L |
Number of independent LD blocks. |
M |
Number of SNPs per LD block. |
rho |
Correlation parameter controlling linkage disequilibrium within blocks. |
n |
Sample size. |
An matrix of simulated genotype values (0, 1, or 2).
## Not run: X <- genRaw(L = 10, M = 5, rho = 0.3, n = 500) ## End(Not run)## Not run: X <- genRaw(L = 10, M = 5, rho = 0.3, n = 500) ## End(Not run)
Implements the HORSE (Heteroscedastic Outlier-Robust causal effect estimation
with Shrinkage for plEiotropy) model for univariate (mr_horse) and
multivariable (mvmr_horse) Mendelian randomization using JAGS.
mr_horse(D, no_ini = 3, variable.names = "theta", n.iter = 10000, n.burnin = 10000) mvmr_horse(D, no_ini = 3, variable.names = "theta", n.iter = 10000, n.burnin = 10000)mr_horse(D, no_ini = 3, variable.names = "theta", n.iter = 10000, n.burnin = 10000) mvmr_horse(D, no_ini = 3, variable.names = "theta", n.iter = 10000, n.burnin = 10000)
D |
A data frame containing columns |
no_ini |
Number of MCMC chains (default 3). |
variable.names |
Character vector of parameters to monitor (default |
n.iter |
Number of MCMC iterations per chain after burn-in (default 10000). |
n.burnin |
Number of burn-in iterations (default 10000). |
A list with elements MR_Estimate (a data frame of point estimates
and diagnostics) and MR_Coda (the MCMC samples as a mcmc.list).
## Not run: D <- data.frame(betaY = Gamma2, betaYse = se2, betaX = gamma1, betaXse = se1) res <- mr_horse(D) ## End(Not run)## Not run: D <- data.frame(betaY = Gamma2, betaYse = se2, betaX = gamma1, betaXse = se1) res <- mr_horse(D) ## End(Not run)
Implements multivariable MR with LASSO-based invalid instrument selection.
cv.mvmr_lasso performs cross-validation to select the LASSO penalty
parameter; mvmr_lasso uses this to obtain post-LASSO causal estimates.
mvmr_lasso(bx, by, seby) cv.mvmr_lasso(bx, by, seby)mvmr_lasso(bx, by, seby) cv.mvmr_lasso(bx, by, seby)
bx |
Matrix of SNP-exposure association estimates (SNPs x exposures). |
by |
Vector of SNP-outcome association estimates. |
seby |
Vector of standard errors for SNP-outcome associations. |
cv.mvmr_lasso returns a list with elements fit (LASSO
coefficients at the selected lambda) and lambda.
mvmr_lasso returns a list with elements thest, a,
lambda, th_post, and se_post.
## Not run: res <- mvmr_lasso(bx = gamma1, by = Gamma2, seby = se2) ## End(Not run)## Not run: res <- mvmr_lasso(bx = gamma1, by = Gamma2, seby = se2) ## End(Not run)
Implements multivariable weighted median MR using quantile regression.
mvmr_med_boot computes bootstrap standard errors.
mvmr_median(bx, sebx, by, seby, boot = FALSE, boot_it = 1000) mvmr_med_boot(bx, sebx, by, seby, N)mvmr_median(bx, sebx, by, seby, boot = FALSE, boot_it = 1000) mvmr_med_boot(bx, sebx, by, seby, N)
bx |
Matrix of SNP-exposure association estimates (SNPs x exposures). |
sebx |
Matrix of standard errors for SNP-exposure associations. |
by |
Vector of SNP-outcome association estimates. |
seby |
Vector of standard errors for SNP-outcome associations. |
boot |
Logical; if |
boot_it |
Number of bootstrap iterations (default 1000). |
N |
Number of bootstrap iterations in |
mvmr_median returns a list with element coefficients and,
if boot = TRUE, element se.
mvmr_med_boot returns a vector of bootstrap standard errors.
## Not run: res <- mvmr_median(bx = gamma1, sebx = se1, by = Gamma2, seby = se2) ## End(Not run)## Not run: res <- mvmr_median(bx = gamma1, sebx = se1, by = Gamma2, seby = se2) ## End(Not run)
Implements multivariable MR using robust regression (MM-estimator) with inverse-variance weighting.
mvmr_robust(bx, by, seby, k.max = 500, maxit.scale = 500)mvmr_robust(bx, by, seby, k.max = 500, maxit.scale = 500)
bx |
Matrix of SNP-exposure association estimates (SNPs x exposures). |
by |
Vector of SNP-outcome association estimates. |
seby |
Vector of standard errors for SNP-outcome associations. |
k.max |
Maximum number of iterations for the M-step (default 500). |
maxit.scale |
Maximum number of iterations for the scale estimation (default 500). |
A list with elements coefficients and se.
## Not run: res <- mvmr_robust(bx = gamma1, by = Gamma2, seby = se2) ## End(Not run)## Not run: res <- mvmr_robust(bx = gamma1, by = Gamma2, seby = se2) ## End(Not run)
Core functions implementing the MVMR-CUE algorithm for multivariable Mendelian randomization that accounts for complex correlated horizontal pleiotropy.
MVMRCUE(gammahM, Gammah, se1M, se2, Re, opts = NULL) MVMRCUEfun(gammahM, Gammah, se1M, se2) MVMRCUEoverlapfun(gammahM, Gammah, se1M, se2, Re, Eta) MVMRCUEIndepSample(gammahM, Gammah, se1M, se2, opts = NULL)MVMRCUE(gammahM, Gammah, se1M, se2, Re, opts = NULL) MVMRCUEfun(gammahM, Gammah, se1M, se2) MVMRCUEoverlapfun(gammahM, Gammah, se1M, se2, Re, Eta) MVMRCUEIndepSample(gammahM, Gammah, se1M, se2, opts = NULL)
gammahM |
Matrix of SNP-exposure association estimates. |
Gammah |
Vector of SNP-outcome association estimates. |
se1M |
Matrix of standard errors for SNP-exposure associations. |
se2 |
Vector of standard errors for SNP-outcome associations. |
Re |
Correlation matrix for overlapping samples. |
Eta |
Eta parameter for overlapping samples. |
opts |
Optional list of algorithm options. |
A list containing the estimated causal effects and associated statistics.
## Not run: result <- MVMRCUE(gamma1, Gamma2, se1, se2, Re = diag(nrow(gamma1))) ## End(Not run)## Not run: result <- MVMRCUE(gamma1, Gamma2, se1, se2, Re = diag(nrow(gamma1))) ## End(Not run)
These four functions are created when
RcppArmadillo.package.skeleton() is invoked to create a
skeleton packages.
rcpparma_hello_world() rcpparma_outerproduct(x) rcpparma_innerproduct(x) rcpparma_bothproducts(x)rcpparma_hello_world() rcpparma_outerproduct(x) rcpparma_innerproduct(x) rcpparma_bothproducts(x)
x |
a numeric vector |
These are example functions which should be largely self-explanatory. Their main benefit is to demonstrate how to write a function using the Armadillo C++ classes, and to have to such a function accessible from R.
rcpparma_hello_world() does not return a value, but displays a
message to the console.
rcpparma_outerproduct() returns a numeric matrix computed as the
outer (vector) product of x.
rcpparma_innerproduct() returns a double computer as the inner
(vector) product of x.
rcpparma_bothproducts() returns a list with both the outer and
inner products.
Dirk Eddelbuettel
See the documentation for Armadillo, and RcppArmadillo, for more details.
x <- sqrt(1:4) rcpparma_innerproduct(x) rcpparma_outerproduct(x)x <- sqrt(1:4) rcpparma_innerproduct(x) rcpparma_outerproduct(x)