R/example_corr.R

#' Example local ancestry correlation
#'
#' Data frame containing local ancestry correlation at pairs of
#' loci separated by various distances apart, for an admixed
#' population with 2 ancestral populations, 6 generations since
#' admixture, and admixture proportions contained in example_props.
#' 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'). Number of rows does not matter.
#'
#' @source Toy example generated with command
#'   \code{thetas <- seq(0, 0.5, length = 51); corr_K2_11 <- sapply(thetas, function(x) exp_corr(x, g = 6, props = example_props, k1 = 1, k2 = 1)); corr_K2_12 <- sapply(thetas, function(x) exp_corr(x, g = 6, props = example_props, k1 = 1, k2 = 2)); corr_K2_22 <- sapply(thetas, function(x) exp_corr(x, g = 6, props = example_props, k1 = 2, k2 = 2)); set.seed(1); example_corr <- data.frame(theta = rep(thetas, times = 3),corr = c(corr_K2_11, corr_K2_12, corr_K2_22) + rnorm(n = length(thetas)*3, mean = 0, sd = 0.01), anc = rep(c('1_1', '1_2', '2_2'), each = length(thetas)))}
#' @name example_corr
NULL
kegrinde/STEAM documentation built on June 30, 2024, 11:27 p.m.