Hi, I am trying to add the non-linear regression tendency line to the Linkage Disequilibrium (LD) plot using R. Please suggest how I can add the non-linear regression tendency line to the LD plot. Here is my code for generating LD plot without the line.
library(ggplot2)
gi_LD <- read.table("gi_LD.ld", sep="\t", header = T, na.strings = "NaN")
ggplot() +
geom_point(aes(gi_LD$Distance_bp, gi_LD$R2), na.rm = T, color ="blue", alpha=0.05) +
labs(x="Chromosome - Physical distance", y=(LD~(r^{2})))
example output:
Hi, Thank you for your reply. I am using plink at the following command to calculate R2. Please let me know if I can make LD plot with non-linear regression tendency line at the output of plink results.
plink --bfile input[prefix] --r2 --indep-pairwise 200 50 0.2 --out output