Package 'mrcovreg'

Title: Package for an efficient and robust approach to Mendelian randomization with measured pleiotropic effects
Description: Implement a method for an efficient and robust approach to Mendelian randomization with measured pleiotropic effects in a high-dimensional setting.
Authors: Andrew Grant [aut, cre]
Maintainer: Andrew Grant <[email protected]>
License: GPL-3
Version: 1.0.0
Built: 2024-10-31 03:03:18 UTC
Source: https://github.com/remlapmot/mrcovreg

Help Index


Cross-validation for mr_covreg

Description

Implements K-fold cross-validation for mr_covreg where the target function is the mean squared error.

Usage

cv.mr_covreg(bx, bw, by, S, lambda = numeric(0), nlam = 100,
  nfolds = 10)

Arguments

bx

Vector of estimates of the genetic variant-risk factor associations.

bw

Matrix of estimates of the genetic variant-covariate associations estimates. The jth column of the matrix is a vector of the estimates of the genetic variant associations with the jth covariate.

by

Vector of estimates of the genetic variant-outcome associations.

S

Diagonal matrix where the jth diagonal entry is the inverse of the variance of the jth genetic variant-outcome association estimate.

lambda

Sequence of lambda values to be used in cross-validation. If not specified (which is the default setting), the sequence of lambda values is chosen by the glmnet package.

nlam

Number of lambda values to use in cross-validation. Default is 100. Note, if a lambda sequence is given, this parameter is redundant.

nfolds

Number of folds for cross-validation. Default is 10.

Value

glmnet.fit

List containing a matrix of coefficients and a vector of the number of non-zero coefficients.

lamseq

Sequence of lambda values used in cross-validation.

lambda.min

The value of lambda that minimised the test mean squared error.

lambda.min

The value of lambda that minimised the test mean squared error with the 1 standard deviation rule applied.


Causal effect estimation via covariate regularization

Description

Estimates a causal effect by implementing regularization on potential pleiotropic covariates. The tuning parameter is chosen by cross-validation.

Usage

mr_covreg(bx, bw, by, S, klessp = TRUE, lambda = numeric(0),
  nlam = 100, K = 10, cv_mt = 2)

Arguments

bx

Vector of estimates of the genetic variant-risk factor associations.

bw

Matrix of estimates of the genetic variant-covariate associations estimates. The jth column of the matrix is a vector of the estimates of the genetic variant associations with the jth covariate.

by

Vector of estimates of the genetic variant-outcome associations.

S

Diagonal matrix where the jth diagonal entry is the inverse of the variance of the jth genetic variant-outcome association estimate.

klessp

Indicates whether the tuning parameter should be always sufficiently large such that there are always less than p - 1 covariates with a non-zero coefficient.

lambda

Sequence of lambda values to be used in cross-validation. If not specified (which is the default setting), the sequence of lambda values is chosen by the glmnet package.

nlam

Number of lambda values to use in cross-validation. Default is 100. Note, if a lambda sequence is given, this parameter is redundant.

K

Number of folds for cross-validation. Default is 10.

cv_mt

Controls which target function to use in cross-validation. If set at 1, the tuning parameter is selected independent of the genetic variant-risk factor associations. Otherwise, the target function is the mean squared error (which is the default).

Value

thest

Causal effect estimate.

thest_1se

Causal effect estimate with the 1 standard error rule applied.

a

Regularized covariate cofficients.

a_1se

Regularized covariate cofficients with the 1 standard error rule applied.

lambda

Value of lambda chosen by cross-validation.

lambda_1se

Value of lambda chosen by cross-validation with the 1 standard error rule applied.

lamseq

Sequence of lambda values used in cross-validation.


Causal effect estimation via covariate regularization for a specified tuning parameter value

Description

Estimates a causal effect by implementing regularization on potential pleiotropic covariates for a given value of the tuning parameter.

Usage

mr_covreg_lam(bx, bw, by, S, lambda)

Arguments

bx

Vector of estimates of the genetic variant-risk factor associations.

bw

Matrix of estimates of the genetic variant-covariate associations estimates. The jth column of the matrix is a vector of the estimates of the genetic variant associations with the jth covariate.

by

Vector of estimates of the genetic variant-outcome associations.

S

Diagonal matrix where the jth diagonal entry is the inverse of the variance of the jth genetic variant-outcome association estimate.

Value

thest

Causal effect estimate.

a

Regularized covariate cofficients.