Skip to contents

With haplotype frequency pAB and allele frequencies pA, pB (pa = 1 - pA, pb = 1 - pB), \(D = p_{AB} - p_A p_B\) and \(r^2 = D^2 / (p_A p_a p_B p_b)\), the squared correlation of allelic state over haplotypes (Hill and Robertson 1968).

Usage

Ldcmpr(geno1, geno2, phased = FALSE)

Arguments

geno1

First locus: allele indicators (phased) or genotype counts (unphased).

geno2

Second locus, same convention.

phased

Logical input convention flag.

Value

List with estimate (r-squared), r, D, Dprime, pA, pB, pAB, r2_genotypic (unphased only), n, method.

Details

Two input conventions: phased = TRUE takes 0/1 allele indicators on aligned haplotypes and computes r-squared exactly; phased = FALSE (default) takes unphased 0/1/2 genotypes and estimates pAB by the fixed-iteration EM of Dprime, oriented to the major allele at each locus (r-squared is invariant to the flip). The squared Pearson correlation of the genotype counts is also reported as r2_genotypic; this is what PLINK 1.9 computes for its r-squared reports (genotype allele counts, phase not considered).

References

Hill, W. G. and Robertson, A. (1968). Linkage disequilibrium in finite populations. Theoretical and Applied Genetics 38(6), 226-231 (r-squared definition, sec. 2). Lewontin, R. C. (1964). Genetics 49(1), 49-67 (D, D-prime). PLINK 1.9 LD documentation (genotype-allele-count correlation). EM phase resolution follows CRAN package genetics R/LD.R as documented in twoldp.R.

Examples

V <- c(1, 2, 3, 4, 5, 6, 7, 8)
Ldcmpr(V, V)
#> $estimate
#> [1] 1
#> 
#> $r
#> [1] 1
#> 
#> $D
#> [1] 0.1875
#> 
#> $Dprime
#> [1] 1
#> 
#> $pA
#> [1] 0.75
#> 
#> $pB
#> [1] 0.75
#> 
#> $pAB
#> [1] 0.75
#> 
#> $r2_genotypic
#> [1] 1
#> 
#> $n
#> [1] 2
#> 
#> $method
#> [1] "LD r^2 (Hill-Robertson 1968), EM-phased genotypes"
#>