Skip to contents

Estimate SNP heritability from GWAS summary statistics using one of three methods: LDER, g-LDSC, or HDL/sHDL.

Usage

estimateH2(
  sumstats,
  ldRef,
  method = "lder",
  annotations = NULL,
  local = FALSE,
  ...
)

# S4 method for class 'GwasSumStats,LdStatistic'
estimateH2(
  sumstats,
  ldRef,
  method = "lder",
  annotations = NULL,
  local = FALSE,
  study = NULL,
  ...
)

Arguments

sumstats

A GwasSumStats object.

ldRef

An LdStatistic object (method-appropriate subclass).

method

Character, one of "lder", "gldsc", "hdl".

annotations

An AnnotationMatrix object, or NULL for unstratified estimation.

local

Logical, whether to compute per-block local estimates.

...

Additional method-specific arguments.

study

Character (length 1) or NULL. Restrict the selection to this study; NULL matches all studies.

Value

An H2Estimate object.

Examples

data(ldEigenExample)
gr <- GenomicRanges::GRanges("chr1",
  IRanges::IRanges(seq(50, by = 100, length.out = 20), width = 1))
S4Vectors::mcols(gr) <- S4Vectors::DataFrame(SNP = paste0("rs", 1:20),
  A1 = "A", A2 = "G", Z = rnorm(20), N = 10000L)
panel <- readGenotypes(
  system.file("extdata", "toy_ref.bed", package = "pecotmr")
)
ss <- GwasSumStats(study = "trait1", entry = list(gr),
  genome = "hg19", ldSketch = panel)
estimateH2(ss, ldEigenExample, method = "lder")
#> H2Estimate for 'trait1' (method: lder)
#>   h2 = -0.0003 (SE = 0.0000)
#>   intercept = 0.0000 (SE = 0.0000)
#>   Local: FALSE, Enrichment: FALSE, tauBlocks: FALSE
#>   N SNPs: 20