Skip to contents

For two 0/1-coded loci observed on the same individuals, returns the squared correlation \(r^2 = D^2 / [p_A(1-p_A)p_B(1-p_B)]\) with \(D = p_{AB} - p_A p_B\) (Lewontin 1964; Hill and Robertson 1968). \(r^2\) is exactly the squared Pearson correlation of the two indicator vectors, which is the form used for LD pruning.

Usage

morie_ld(locus_a, locus_b)

Arguments

locus_a, locus_b

Equal-length vectors containing only 0 and 1.

Value

A list with name, statistic (\(r^2\)), n, and extra holding D, pA, pB.

References

Hill, W. G. and Robertson, A. (1968). Linkage disequilibrium in finite populations. Theoretical and Applied Genetics, 38, 226-231.

Examples

a <- c(1, 1, 0, 0, 1, 0, 1, 0); b <- c(1, 1, 0, 0, 1, 1, 0, 0)
morie_ld(a, b)$statistic
#> [1] 0.25
cor(a, b)^2
#> [1] 0.25