Package 'MVMRcML'

Title: Multivariable Mendelian randomization based on constrained maximum likelihood
Description: Robust multivariable Mendelian randomization based on constrained maximum likelihood.
Authors: Zhaotong Lin
Maintainer: Zhaotong Lin <[email protected]>
License: MIT + file LICENSE
Version: 0.1.0
Built: 2024-08-03 02:39:08 UTC
Source: https://github.com/ZhaotongL/MVMR-cML

Help Index


Generate the list of inverse of covariance matrices used in MVMR-cML-DP

Description

Generate the list of inverse of covariance matrices used in MVMR-cML-DP

Usage

invcov_mvmr(se_bx, se_by, rho_mat)

Arguments

se_bx

A m*L matrix of standard errors of SNP-exposure association

se_by

A vector of standard errors of SNP-outcome association

rho_mat

A (L+1)×\times(L+1) correlation matrix among the L exposures and the outcome, note that the upper-left L×\timesL submatrix corresponding to the L exposures.

Value

A list of inverse of covariance matrices with respect to each genetic variant, retaining the ordering in se_bx


Standard error estimate for MVMR-cML-BIC

Description

This is based on the profile likelihood of the set of valid IVs, which is not robust to uncertainty in model selection.

Usage

MVcML_SdTheta(b_exp, b_out, Sig_inv_l, theta, zero_ind, r_vec = NULL)

Arguments

b_exp

A matrix of SNP effects on the exposure variable.

b_out

A vector of SNP effects on the outcome variable.

Sig_inv_l

A list of inverse of covariance matrix.

theta

A vector of final estimates of causal effect of each exposure by MVMR-cML-BIC obtained from MVmr_cML_DP.

zero_ind

A vector of the index of valid IVs.

r_vec

A vector of estimated horizontal pleiotropic effects.

Value

A vector


MVMRcML method with BIC selection

Description

This is the main function of MVMR-cML.

Usage

MVmr_cML(
  b_exp,
  b_out,
  se_bx,
  Sig_inv_l,
  n,
  K_vec = as.numeric(c()),
  random_start = 1L,
  maxit = 100L,
  thres = 1e-04
)

Arguments

b_exp

A m*L matrix of SNP effects on the exposure variable.

b_out

A m*1 matrix of SNP effects on the outcome variable.

se_bx

A m*L matrix of standard errors of b_exp.

Sig_inv_l

A list of the inverse of m covariance matrices, generated by invcov_mvmr().

n

The smallest sample size of the L+1 GWAS dataset.

K_vec

Sets of candidate K's, the constraint parameter representing number of invalid IVs.

random_start

Number of random start points, default is 1.

maxit

Maximum number of iterations for each optimization, default is 100.

thres

Threshold for convergence criterion.

Value

A list

BIC_theta

Estimated causal effect from MVMR-cML-BIC

BIC_invalid

Invalid IVs selected by MVMR-cML-BIC

K_vec

K_vec to be searched from

Converge

0 if converge; 1 otherwise

BIC_vec

BIC vector corresponding to K_vec


MVMRcML method with Data Perturbation

Description

This is the main function of MVMR-cML.

Usage

MVmr_cML_DP(
  b_exp,
  b_out,
  se_bx,
  Sig_inv_l,
  n,
  K_vec = as.numeric(c()),
  random_start = 1L,
  num_pert = 100L,
  maxit = 100L,
  thres = 1e-04
)

Arguments

b_exp

A m*L matrix of SNP effects on the exposure variable.

b_out

A m*1 matrix of SNP effects on the outcome variable.

se_bx

A m*L matrix of standard errors of b_exp.

Sig_inv_l

A list of the inverse of m covariance matrices, generated by invcov_mvmr().

n

The smallest sample size of the L+1 GWAS dataset.

K_vec

Sets of candidate K's, the constraint parameter representing number of invalid IVs.

random_start

Number of random start points, default is 1.

num_pert

Number of perturbation, default is 100.

maxit

Maximum number of iterations for each optimization, default is 100.

thres

Threshold for convergence criterion.

Value

A list

BIC_theta

Estimated causal effect from MVMR-cML-BIC

BIC_invalid

Invalid IVs selected by MVMR-cML-BIC

BIC_DP_theta

Estimated causal effect from MVMR-cML-DP

BIC_DP_se

Estimate standard error for BIC_DP_theta

eff_DP_B

Data perturbation with successful convergence