Skip to contents

ldsc_h2() uses ldscore regression to estimate the heritability of a trait from GWAS summary statistics and reference LD information.

Usage

ldsc_h2(
  munged_sumstats,
  ancestry,
  sample_prev = NA,
  population_prev = NA,
  ld,
  wld,
  n_blocks = 200,
  chisq_max = NA,
  chr_filter = seq(1, 22, 1)
)

Arguments

munged_sumstats

Either a dataframe, or a path to a file containing munged summary statistics. Must contain at least columns named SNP (rsid), A1 (effect allele), A2 (non-effect allele), N (total sample size) and Z (Z-score)

ancestry

(character) One of "AFR", "AMR", "CSA", "EAS", "EUR", or "MID", which will utilize the appropriate built-in ld and wld files from Pan-UK Biobank. If empty or NULL, the user must specify paths to ld and wld files.

sample_prev

(numeric) For binary traits, this should be the prevalence of cases in the current sample, used for conversion from observed heritability to liability-scale heritability. The default is NA, which is appropriate for quantitative traits or estimating heritability on the observed scale.

population_prev

(numeric) For binary traits, this should be the population prevalence of the trait, used for conversion from observed heritability to liability-scale heritability. The default is NA, which is appropriate for quantitative traits or estimating heritability on the observed scale.

ld

(character) Path to directory containing ld score files, ending in *.l2.ldscore.gz. Default is NA, which will utilize the built-in ld score files from Pan-UK Biobank for the ancestry specified in ancestry.

wld

(character) Path to directory containing weight files. Default is NA, which will utilize the built-in weight files from Pan-UK Biobank for the ancestry specified in ancestry.

n_blocks

(numeric) Number of blocks used to produce block jackknife standard errors. Default is 200

chisq_max

(numeric) Maximum value of Z^2 for SNPs to be included in LD-score regression. Default is to set chisq_max to the maximum of 80 and N*0.001.

chr_filter

(numeric vector) Chromosomes to include in analysis. Separating even/odd chromosomes may be useful for exploratory/confirmatory factor analysis.

Value

A tibble containing heritability information. If sample_prev and population_prev were provided, the heritability estimate will also be returned on the liability scale.

Examples

if (FALSE) {
ldsc_h2(sumstats_munged_example(example = "BMI", dataframe = TRUE), ancestry = "EUR")
}