Learn R Programming

bigsnpr (version 1.6.1)

snp_ldpred2_inf: LDpred2

Description

LDpred2. Tutorial at https://privefl.github.io/bigsnpr/articles/LDpred2.html.

Usage

snp_ldpred2_inf(corr, df_beta, h2)

snp_ldpred2_grid( corr, df_beta, grid_param, burn_in = 50, num_iter = 100, ncores = 1, return_sampling_betas = FALSE )

snp_ldpred2_auto( corr, df_beta, h2_init, vec_p_init = 0.1, burn_in = 1000, num_iter = 500, sparse = FALSE, verbose = FALSE, ncores = 1 )

Arguments

corr

Sparse correlation matrix as an SFBM. If corr is a dsCMatrix or a dgCMatrix, you can use as_SFBM(corr).

df_beta

A data frame with 3 columns:

  • $beta: effect size estimates

  • $beta_se: standard errors of effect size estimates

  • $n_eff: sample size when estimating beta (in the case of binary traits, this is 4 / (1 / n_control + 1 / n_case))

h2

Heritability estimate.

grid_param

A data frame with 3 columns as a grid of hyper-parameters:

  • $p: proportion of causal variants

  • $h2: heritability (captured by the variants used)

  • $sparse: boolean, whether a sparse model is sought They can be run in parallel by changing ncores.

burn_in

Number of burn-in iterations.

num_iter

Number of iterations after burn-in.

ncores

Number of cores used. Default doesn't use parallelism. You may use nb_cores.

return_sampling_betas

Whether to return all sampling betas (after burn-in)? This is useful for assessing the uncertainty of the PRS at the individual level (see 10.1101/2020.11.30.403188). Default is FALSE (only returns the averaged final vectors of betas). If TRUE, only one set of parameters is allowed.

h2_init

Heritability estimate for initialization.

vec_p_init

Vector of initial values for p. Default is 0.1.

sparse

In LDpred2-auto, whether to also report a sparse solution by running LDpred2-grid with the estimates of p and h2 from LDpred2-auto, and sparsity enabled. Default is FALSE.

verbose

Whether to print "p // h2" estimates at each iteration.

Value

snp_ldpred2_inf: A vector of effects, assuming an infinitesimal model.

snp_ldpred2_grid: A matrix of effect sizes, one vector (column) for each row of grid_param. If using return_sampling_betas, each column corresponds to one iteration instead (after burn-in).

snp_ldpred2_auto: A list (over vec_p_init) of lists with

  • $beta_est: vector of effect sizes

  • $beta_est_sparse (only when sparse = TRUE): sparse vector of effect sizes

  • $postp_est: vector of posterior probabilities of being causal

  • $p_est: estimate of p, the proportion of causal variants

  • $h2_est: estimate of the (SNP) heritability (also see coef_to_liab)

  • $path_p_est: full path of p estimates (including burn-in); useful to check convergence of the iterative algorithm

  • $path_h2_est: full path of h2 estimates (including burn-in); useful to check convergence of the iterative algorithm

  • $h2_init and $p_init