Skip to contents

This function estimates the number of single effects in a locus by combining profile-likelihood methods and Bayesian Information Criterion (BIC) to optimize the model. It includes resampling for estimating standard errors and performs score tests for infinitesimal effects.

Usage

tgvis(
  estimate_inf = F,
  by,
  bXest,
  LD,
  Noutcome,
  L_vec = c(1:8),
  var_inf = 1e-07,
  estimate_residual_variance = F,
  scaled_prior_variance = 0.5,
  residual_variance = 1,
  max_iter = 50,
  max_eps = 0.001,
  susie_iter = 500,
  pip_thres_cred = 0.95,
  eigen_thres = 0.999,
  varinf_upper_boundary = 0.25,
  varinf_lower_boundary = 0.001,
  ebic_beta = 1,
  ebic_upsilon = 1,
  pip_min = 0.05,
  pv_thres = 0.05,
  pleiotropy_rm = NULL,
  prior_weight_theta = NULL,
  prior_weight_gamma = NULL,
  standization = T
)

Arguments

estimate_inf

An indicator of whether estimating the infinitesimal effect. Default is F.

by

A vector of Z-scores of the marginal effects from the outcome GWAS.

bXest

A matrix of direct effect estimates based on the Z-scores of tissue-gene pairs.

LD

The LD matrix of variants.

Noutcome

The sample size of the outcome GWAS.

L_vec

A vector of candidate numbers of single effects used in BIC. Default is `c(1:8)`.

var_inf

When estimate_inf = F, the variance of infinitesimal effect (estimated by LDSC possibly). Default is 1e-7.

estimate_residual_variance

An indicator of whether of not estimating the variance of residuals in SuSiE. Default is F.

scaled_prior_variance

The prior variance of signals in SuSiE. Default is 0.5 which is slightly larger than 0.2 in SuSiE software.

residual_variance

The residual variance. Default is 1.

max_iter

The maximum number of iterations for the profile-likelihood algorithm. Default is 50.

max_eps

The convergence tolerance for the profile-likelihood algorithm. Default is 1e-3.

susie_iter

The maximum number of iterations for `susie_rss` within the profile-likelihood algorithm. Default is 50.

pip_thres_cred

The cumulative PIP threshold for variables in a credible set. Default is 0.95.

eigen_thres

The threshold of eigenvalues for modelling the infinitesimal effect. Default is 1.

varinf_upper_boundary

The upper boundary for the prior variance of infinitesimal effects, multiplied by var(y) to adapt to different locus variances. Default is 0.25.

varinf_lower_boundary

The lower boundary for the prior variance of infinitesimal effects, not multiplied by var(y). Default is 0.001.

ebic_beta

The extended BIC factor for causal effects of tissue-gene pairs and direct causal variants used in BIC computation. Default is 1.

ebic_upsilon

The extended BIC factor for infinitesimal effects used in BIC computation. Default is 1.

pip_min

The minimum PIP threshold for individual causal effects in the profile-likelihood. This is used to specify which tissue-gene pairs and direct causal variants to include in the score test of variance of infinitesimal effects. Default is 0.05.

pv_thres

The p-value threshold for the score test. Default is 0.05.

pleiotropy_rm

A vector of indices specifying which variants should not be considered as having direct causal effects.

prior_weight_theta

A vector of prior weights of gene-tissue pairs, which will be used as input in SuSiE. Default is NULL.

prior_weight_gamma

A vector of prior weights of direct causal variants, which will be used as input in SuSiE. Default is NULL.

standization

A indicator of whether standardizing the input when performing SuSiE for fine-mapping causal gene-tissue pairs and direct causal variants. Default is T.

Value

A list containing:

theta

The estimated effects for tissue-gene pairs, scaled by the outcome GWAS sample size.

gamma

The estimated effects for direct causal variants, scaled by the outcome GWAS sample size.

theta.pip

Posterior inclusion probabilities (PIP) for tissue-gene pairs.

gamma.pip

Posterior inclusion probabilities (PIP) for direct causal variants.

theta.pratt

Pratt estimations for tissue-gene pairs.

gamma.pratt

Pratt estimations for direct causal variants.

theta.cs

Credible set indicators for tissue-gene pairs.

gamma.cs

Credible set indicators for direct causal variants.

theta.cs.pip

PIP within credible sets for tissue-gene pairs.

gamma.cs.pip

PIP within credible sets for direct causal variants.

upsilon

The estimated infinitesimal effects.

var.upsilon

The estimated variance of infinitesimal effects.

fit.causal

The SuSiE fit object for the causal analysis.

cs.summary

A summary of the credible sets obtained from the analysis.

Bicvec

A vector of BIC values for each candidate number of single effects.