set.seed(1)
n <- 100 # sample size
K <- 6 # ploidy
## generate some fake genotypes when LD = 0.
ga <- stats::rbinom(n = n, size = K, prob = 0.5)
gb <- stats::rbinom(n = n, size = K, prob = 0.5)
head(ga)
head(gb)
## generate some fake genotype likelihoods when LD = 0.
gamat <- t(sapply(ga, stats::dnorm, x = 0:K, sd = 1, log = TRUE))
gbmat <- t(sapply(gb, stats::dnorm, x = 0:K, sd = 1, log = TRUE))
head(gamat)
head(gbmat)
## Composite LD with genotypes
ldout1 <- ldest_comp(ga = ga,
gb = gb,
K = K)
head(ldout1)
## Composite LD with genotype likelihoods
ldout2 <- ldest_comp(ga = gamat,
gb = gbmat,
K = K,
se = FALSE,
model = "flex")
head(ldout2)
## Composite LD with genotype likelihoods and proportional bivariate normal
ldout3 <- ldest_comp(ga = gamat,
gb = gbmat,
K = K,
model = "norm")
head(ldout3)
Run the code above in your browser using DataLab