Package 'CaPri'

Title: Bayesian Mendelian Randomization with Potentially Pleiotropic Instruments
Description: Bayesian Mendelian randomization using GWAS summary statistics that jointly estimates the causal effect of an exposure on an outcome and the direct pleiotropic effects of genetic instruments, using variational inference.
Authors: Ou Ren [aut, cre]
Maintainer: Ou Ren <[email protected]>
License: MIT + file LICENSE
Version: 0.0.0.9000
Built: 2026-10-20 09:46:43 UTC
Source: https://github.com/OuRen0104/CaPri

Help Index


Extract coefficients from a CaPri fit

Description

Extract coefficients from a CaPri fit

Usage

## S3 method for class 'capri'
coef(object, ...)

Arguments

object

An object of class capri.

...

Additional arguments.

Value

A named numeric vector.


Fit CaPri using summary statistics

Description

Fits the CaPri Mendelian randomization model using SNP-level summary statistics. This summary-statistics version assumes independent variants, corresponding to an identity LD matrix by default.

Usage

fit_capri_sumstats(
  muY,
  betaX,
  n,
  allele_mode = c("as_is", "minor"),
  eaf = NULL,
  pi_delta = 0.01,
  pi_c = 0.5,
  tau_gamma = 1,
  tau_beta = 0,
  sigma_Y = 1,
  max_iter = 2000,
  eps_theta = 1e-06,
  patience = 5,
  verbose = 1
)

Arguments

muY

Numeric vector of SNP-outcome summary association estimates.

betaX

Numeric vector of SNP-exposure summary association estimates.

n

Sample size used for the summary statistics.

allele_mode

Character string specifying allele orientation. If "as_is", summary statistics are used without modification. If "minor", SNP effects are flipped so that effects correspond to the minor allele direction.

eaf

Numeric vector of effect allele frequencies. Required when allele_mode="minor".

pi_delta

Prior probability of a causal effect.

pi_c

Prior probability that an instrument is pleiotropic.

tau_gamma

Prior precision for the causal effect.

tau_beta

Prior precision for the pleiotropic effect.

sigma_Y

Residual standard deviation of the outcome model.

max_iter

Maximum number of variational inference iterations.

eps_theta

Parameter convergence threshold.

patience

Number of consecutive stable iterations required for convergence.

verbose

Whether to print progress during variational inference.

Value

An object of class capri.


Plot a CaPri fit

Description

Plot a CaPri fit

Usage

## S3 method for class 'capri'
plot(x, ...)

Arguments

x

An object of class capri.

...

Additional arguments passed to graphics::plot.

Value

Invisibly returns x.


Print a CaPri fit

Description

Print a CaPri fit

Usage

## S3 method for class 'capri'
print(x, ...)

Arguments

x

An object of class capri.

...

Additional arguments.

Value

Invisibly returns x.


Summarize a CaPri fit

Description

Summarize a CaPri fit

Usage

## S3 method for class 'capri'
summary(object, ...)

Arguments

object

An object of class capri.

...

Additional arguments.

Value

Invisibly returns object.