Could any kind of person tell me the formula to calculate Linkage disequilibrium in the plink. The results calculated by plink is different from that calculated by the script I wrote which uses the R2 = (ad - bc)^2/((a + b)(a+c)(c+d)(b+d)). Thank you.
@chrchang523 Please, could you provide a numerical example? How PLINK recode snp (two columns) into one numeric value? Is 11=0; 22=2; 12=21=1? And then, how correlation is calculated? Thank you for your help!
EDIT: I think I found how plink caculates de r2. The program counts the number of copies of the allele with the minor freq in each SNP and then calculates de correlation for this count:
And then, correlation between
counts_in_snp1
andcounts_in_snp2
.