Skip to contents

Simulate Genotypes Based on LD Matrix

Usage

sim_geno_LD(
  n,
  LD,
  min_maf = 0.01,
  max_maf = 0.4,
  lambda = 0.001,
  is.discrete = FALSE,
  scale = FALSE,
  tol = sqrt(.Machine$double.eps)
)

Arguments

n

Sample size.

LD

LD matrix.

min_maf

Minimum minor allele frequency.

max_maf

Maximum minor allele frequency.

lambda

Regularization parameter.

is.discrete

Logical, whether to generate discrete (TRUE) or continuous (FALSE) genotypes.

scale

Logical, whether to scale the data.

tol

Tolerance for checking diagonal elements of LD matrix.

Value

A matrix of genotypes.

Examples

sim_geno_LD(n = 100, LD = matrix(runif(100), 10, 10), min_maf = 0.01, max_maf = 0.4, lambda = 1e-3, is.discrete = FALSE, scale = TRUE)
#> Error in sim_geno_LD(n = 100, LD = matrix(runif(100), 10, 10), min_maf = 0.01,     max_maf = 0.4, lambda = 0.001, is.discrete = FALSE, scale = TRUE): LD matrix should be symmetric!