Skip to contents

Maximize the log likelihood to infer the heritability enrichment fold.

Usage

sHDL.optim(
  ref.data,
  N,
  start.v = c(1, 0.1, 1),
  output.file = NULL,
  log.file = "",
  stepwise = FALSE,
  fix.h2 = NULL,
  fix.intercept = NULL,
  lim = exp(-18),
  verbose = FALSE,
  clust = NULL,
  lwr = NULL,
  upr = NULL,
  maxit = 1000,
  pgtol = 0.001
)

Arguments

ref.data

A list of data matched to LD reference generated by sHDL.reduct.dim.

N

The sample size of the GWAS.

start.v

A vector of starting values c(fold, h2, intercept) for optimization.

output.file

Where the log and results should be written.

log.file

Where the log should be written.

stepwise

Whether to estimate enrichment fold by estimating heritability and intercept first, default stepwise = FALSE. If fix.h2 and fix.intercept are not NULL, stepwise will be overridden.

fix.h2

Whether to fix the heritability to fix.h2 or estimate the heritability, default fix.h2 = NULL, which means estimate the heritability.

fix.intercept

Whether to fix the intercept to fix.intercept or estimate the intercept, default fix.intercept = NULL, which means estimate the intercept.

lim

Tolerance limitation to ensure the positive-definiteness of covariance matrices, default lim = exp(-18).

verbose

Whether to print the log on the console, default verbose = FALSE.

clust

A cluster object generated by parallel::makeCluster.

lwr

Lower bounds for c(fold, h2, intercept). Default is NULL, which means c(0, 0, 0.1).

upr

Upper bounds for c(fold, h2, intercept). Default is NULL, which means c(M / Md, 1, 5), where Md is the sum of annotation weights and M is the total number of SNPs.

maxit

Maximum number of iterations, default maxit = 1000.

pgtol

Tolerance for convergence, default pgtol = 1e-3.

Value

A list is returned with:

  • time Time elapsed in seconds for optimization.

  • fold The estimated heritability enrichment fold.

  • h2 The estimated SNP-based heritability.

  • intercept The estimated intercept.

  • fold.se The standard error of the estimated heritability enrichment fold.

  • h2.se The standard error of the estimated heritability.

  • intercept.se The standard error of the estimated intercept.

  • fold.p P-value based on Wald test for the estimated heritability enrichment fold.

  • h2.p P-value based on Wald test for the estimated heritability.

  • intercept.p P-value based on Wald test for the estimated intercept.

  • stepwise Whether the optimization is done in a stepwise manner.

  • converged Whether the optimization converges.

  • message The message returned by optim.