grappleRobustEst: Robust multivariate MR estimation

View source: R/mr_fun_general.R

grappleRobustEstR Documentation

Robust multivariate MR estimation

Description

The main function of GRAPPLE to estimate causal effects of risk factors beta under a random effect model of the pleiotropic effects.

Usage

grappleRobustEst(
  data,
  p.thres = NULL,
  cor.mat = NULL,
  tau2 = NULL,
  loss.function = c("tukey", "huber", "l2"),
  k = switch(loss.function[1], l2 = NA, huber = 1.345, tukey = 4.685),
  niter = 20,
  tol = .Machine$double.eps^0.5,
  opt.method = "L-BFGS-B",
  diagnosis = T,
  plot.it = T
)

Arguments

data

A data frame containing the information of the selected genetic instruments. One can simply take the data element from the output of function getInput, or provide their own data frame. The required columns include SNP for the SNP rsID, the columns gamma_exp1 to gamma_expk for the estimated effect sizes of the SNPs on risk factors 1 to k, the columns se_exp1 to se_expk for their standard deviations, the columns gamma_out1 to gamma_outm for the estimated effect sizes of the SNPs on diseases 1 to m,the columns se_out1 to se_outm for their standard deviations.

p.thres

The p-value threshold for SNP selection. The SNPs whose selection_pvals are less than p.thres are selected. The default value is NULL, which is to include all SNPs in data. If it is not NULL, then data should have a column selection_pvals that stores the selection p-value of each SNP.

cor.mat

Either NULL or a k + 1 by k + 1 symmetric matrix. The shared correlation matrix for (b_exp[j], b_out[j]) across SNP j. Used only when input.list is NULL and the default value is NULL, for the identity matrix.

tau2

The dispersion parameter. The default value is NULL, which is to be estimated by the function

loss.function

Loss function used, one of "tukey", "huber" or "l2". Default is "tukey", which is robust to outlier SNPs with large pleiotropic effects

k

Tuning parameters of the loss function, for loss "l2", it is NA, for loss "huber", default is 1.345 and for loss "tukey", default is 4.685

niter

Number of maximum iterations allowed for optimization. Default is 20

tol

Tolerance for convergence, default is the square root of the smallest positive floating number depending on the machine R is running on

opt.method

the optimization used, which is one of choices the R function optim accepts. Default value is "L-BFGS-B".

diagnosis

Run diagnosis analysis based on the residuals or not, default is FALSE

plot.it

Whether show the QQ-plot or not if diagnosis if performed. Default is TRUE.

Value

A list with elements

beta.hat

Point estimates of beta

tau2.hat

Point estimates of the pleiotropic effect variance tau2 if the argument tau2 is set to NULL

beta.variance

Estimated covariance matrix of beta.hat

tau2.se

Estimated standard deviation of tau2.hat

beta.p.vaue

A vector of p-values where the kth element is the p-value for whether beta_k = 0

std.resid

Returned if diagnosis is TRUE. A vector of standardized residuals of each SNP


jingshuw/GRAPPLE-beta- documentation built on March 29, 2024, 1:26 p.m.