# Load data
data(AGT)
x <- as.bed.matrix(AGT.gen, AGT.fam, AGT.bim)
x <- set.stats(x)
standardize(x) <- 'mu'
# generate a random positive matrix (to play the role of the GRM)
set.seed(1)
R <- random.pm(nrow(x))
# simulate phenotype with effect of SNP #351 and a polygenic component
y <- x %*% c(rep(0,350),0.25,rep(0,ncol(x)-351)) + lmm.simu(0.3,1,eigenK=R$eigen)$y
# association test
t <- association.test(x, y, eigenK = R$eigen)
# (mini) Manhattan plot
plot(-log10(t$p), xlab="SNP index", ylab = "-log(p)")
# link between p-values and LD with SNP #351
lds <- LD(x, 351, c(1,ncol(x)))
plot(lds, -log10(t$p), xlab="r^2", ylab="-log(p)")Run the code above in your browser using DataLab