compute_data_driven_covs: Compute data-driven covariance matrices.

View source: R/compute_covs.R

compute_data_driven_covsR Documentation

Compute data-driven covariance matrices.

Description

Function to compute data-driven covariance matrices from summary statistics using PCA, FLASH and the sample covariance. These matrices are de-noised using Extreme Deconvolution.

Usage

compute_data_driven_covs(
  sumstats,
  subset_thresh = NULL,
  n_pcs = 3,
  flash_factors = c("default", "nonneg"),
  flash_remove_singleton = FALSE,
  Gamma = diag(ncol(sumstats$Bhat))
)

Arguments

sumstats

a list with two elements. 1 - Bhat, a numeric vector of regression coefficients. 2 - Shat, a numeric vector of of standard erros for the regression coefficients.

subset_thresh

scalar indicating the threshold for selecting the effects to be used for computing the covariance matrices based on false local sign rate (lfsr) for a response-by-response ash analysis.

n_pcs

indicating the number of principal components to be selected.

flash_factors

factors "default" to use flashr default function to initialize factors, currently udv_si. "nonneg" to implement a non-negative constraint on the factors

flash_remove_singleton

whether or not factors corresponding to singleton matrices should be removed from output.

Gamma

an r x r correlation matrix for the residuals; must be positive definite.

Value

A list containing the (de-noised) data-driven covariance matrices.


stephenslab/mr.mash.alpha documentation built on Feb. 7, 2025, 10:06 p.m.