LD: Compute linkage disequilibrium (LD)

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Compute the linkage disequilibrium (LD) between a pair of loci.

Usage

1
LD(x, y, is_phased = TRUE, any_na = TRUE, r_only = FALSE, check = TRUE)

Arguments

x

A numeric vector. The haplotype/genotype data of the first locus. If they are phased, there must only contain 0 and 1. If they are unphased, they must only contain 0, 1, or 2, where 1 codes for the heterozygot.

y

A numeric vector. The haplotype/genotype data of the second locus.

is_phased

A logical. Are the data phased?

any_na

A logical. May some genotypes contain missing values? If not, computations are more efficient for phased genotypes.

r_only

Should only the r-statistic be computed? (Produces minimal output for saving memory and computation time.)

check

A logical. Should checks be performed?

Details

For computing LD among a large number of loci, please use LD_mult, which is much more efficient for that.

Linkage disequilibrium (LD) is the non-random association of marker alleles and can arise from marker proximity or from selection bias.

Three estimators of LD are computed:

where

For genotype data, AB/ab cannot be distinguished from aB/Ab. Consequently, we estimate p(AB) using maximum likelihood and use this value in the computations.

Value

LD returns a list with the following components:

Author(s)

Dominik Mueller (dominikmueller64@yahoo.de) The documentation is adapted from the LD function of the genetics package by Gregory Warnes.

See Also

transform_geno, LD_mult

Examples

1
2
3
4
5
6
7
8
# phased data
data('population', package = 'LDtools')
LD(x = X[, 1], y = X[, 2], is_phased = TRUE, any_na = FALSE)

# unphased data
tmp <- transform_geno(.gen_geno(n = 20L, m = 2L))
LD(x = tmp$geno[, 1], y = tmp$geno[, 2], is_phased = FALSE,
any_na = TRUE)

DominikMueller64/LDtools documentation built on May 6, 2019, 2:51 p.m.