R/example_corr_K3.R

#' Example local ancestry correlation: K = 3
#'
#' Data frame containing local ancestry correlation at pairs of
#' loci separated by various distances apart, for an admixed
#' population with 3 ancestral populations, 10 generations since
#' admixture, and admixture proportions contained in example_props_K3.
#' Values generated by adding noise to expected correlation,
#' and some values may lie outside (-1,1), which in practice should
#' not occur.
#'
#' @format Data frame should 3 columns named theta, corr, and anc.
#'   The theta column contains recombination fraction between loci.
#'   The corr column contains correlation in local ancestry at the loci.
#'   The anc column indicated which ancestral components are being
#'   compared (e.g., '1_1', '1_2', '2_3'). Number of rows does not matter.
#'
#' @source Toy example generated with command
#'   \code{thetas <- seq(0, 0.5, length = 51); corr_K3_11 <- sapply(thetas, function(x) exp_corr(x, g = 10, props = example_props_K3, k1 = 1, k2 = 1)); corr_K3_12 <- sapply(thetas, function(x) exp_corr(x, g = 10, props = example_props_K3, k1 = 1, k2 = 2)); corr_K3_13 <- sapply(thetas, function(x) exp_corr(x, g = 10, props = example_props_K3, k1 = 1, k2 = 3)); corr_K3_22 <- sapply(thetas, function(x) exp_corr(x, g = 10, props = example_props_K3, k1 = 2, k2 = 2)); corr_K3_23 <- sapply(thetas, function(x) exp_corr(x, g = 10, props = example_props_K3, k1 = 2, k2 = 3)); corr_K3_33 <- sapply(thetas, function(x) exp_corr(x, g = 10, props = example_props_K3, k1 = 3, k2 = 3)); set.seed(1); example_corr_K3 <- data.frame(theta = rep(thetas, times = 6), corr = c(corr_K3_11, corr_K3_12, corr_K3_13, corr_K3_22, corr_K3_23, corr_K3_33) + rnorm(n = length(thetas)*6, mean = 0, sd = 0.01), anc = rep(c('1_1','1_2','1_3','2_2','2_3','3_3'), each = length(thetas)))}
#' @name example_corr_K3
NULL
GrindeLab/STEAMcpp_mirror documentation built on Dec. 31, 2020, 12:05 p.m.