Last modified: r params$lastmod.

Here is a chunk output

params$lastmod

IN the notation of @jannink2003estimating, the sequence of updates per iteration is:

  1. update QTL inheritance matrix $Q$
  2. update QTL allelic effects $a$
  3. update family means $\beta$ and residual variance $\sigma^2$
  4. update configuration given number of alleles, ie, $C | l$
  5. update the number of alleles $l$

The later @jannink2004optimal uses a similar sequence of updates:

  1. Update the number of QTL alleles
  2. Update the configuration given the number of alleles
  3. update QTL variance (when there are multiple QTL)
  4. update allelic effects
  5. update position and genotypes jointly
  6. update family means

Simulate traits

gg <- readRDS("../data/derived_data/attie_geno.rds")
library(magrittr)
config <- matrix(nrow = 8, ncol = 2)
config[, 1] <- rep(c(0, 1), each = 4)
config[, 2] <- 1 - config[, 1]
# simulate a trait
set.seed(2020-02-20)
tr <- reducedscan::sim1(aprobs = gg$`1`[ , , 100], allelic_series = config, allelic_effects = c(-2, 2), error_variance = 1)
s1_out <- qtl2::scan1(genoprobs = gg, pheno = tr)
map <- readRDS("../data/derived_data/attie_map.rds")
plot(s1_out, map = map, chr = 1)
peak_index <- qtl2::find_peaks(s1_out, map = map) %>%
  dplyr::filter(chr == 1) %>%
  dplyr::select(pos) %>%
  unlist() %>%
  (function(x) which(map$`1` == x))
# get the founder allele effects
s1c_out <- qtl2::scan1coef(genoprobs = gg[ , 1], pheno = tr)
qtl2::plot_coefCC(s1c_out, map)
effects <- s1c_out %>%
  (function(x) qtl2pleio::get_effects(marker_index = peak_index, allele_effects_matrix = x, map = map$`1`))
set.seed(2020-02-04)
mcmc_out_poisson2 <- reducedscan::jannink_mcmc(niter = 10000, 
                                      initial_values = list(configuration = diag(8), 
                                                            effects = effects, 
                                                            residual_variance = 1), 
                                      genoprobs = gg$`1`[ , , 100], 
                                      trait = tr, 
                                      allelic_number_prior = "poisson", 
                                      poisson_prior_mean = 2)
mcmc_out_poisson2_rv <- jannink_mcmc_rv_only(niter = 10000, 
                                      initial_values = list(configuration = config, 
                                                            effects = c(-2, 2), 
                                                            residual_variance = 10), 
                                      genoprobs = geno$`1`[ , , 100], 
                                      trait = tr, 
                                      allelic_number_prior = "poisson", 
                                      poisson_prior_mean = 2)
mcmc_out_poisson2_rv_fx <- reducedscan::jannink_mcmc_rv_fx_only(niter = 10000, 
                                      initial_values = list(configuration = config, 
                                                            effects = c(-10, 10), 
                                                            residual_variance = 3), 
                                      genoprobs = geno$`1`[ , , 100], 
                                      trait = tr, 
                                      allelic_number_prior = "poisson", 
                                      poisson_prior_mean = 2)



mcmc_out_uniform <- reducedscan::jannink_mcmc(niter = 10000, 
                                      initial_values = list(configuration = diag(8), 
                                                            effects = effects, 
                                                            residual_variance = 1), 
                                      genoprobs = geno$`1`[ , , 100], 
                                      trait = tr, 
                                      allelic_number_prior = "uniform", 
                                      poisson_prior_mean = 2)
mcmc_out_poisson3 <- reducedscan::jannink_mcmc(niter = 10000, 
                                      initial_values = list(configuration = diag(8), 
                                                            effects = effects, 
                                                            residual_variance = 1), 
                                      genoprobs = geno$`1`[ , , 100], 
                                      trait = tr, 
                                      allelic_number_prior = "poisson", 
                                      poisson_prior_mean = 3)

Multiple univariate traits analysis

I noticed that super-strong traits allow the MCMC to recover the true parameter values. However, in those with smaller LODs, the simulation's parameters tend to be poorly recovered. What gives? And where how weak is "weak" for a trait? I need an algorithm that recovers, reasonably well, the configuration for traits that have lods in the range of 5 to 10. If I can only recover the configuration for traits that have lods over 100, this is useless!

I'll try simulating a collection of traits. I hold constant the configuration among the traits and the residual variance. The traits differ in inputted effects.

tr30 <- reducedscan::sim1(aprobs = geno$`1`[, , 1000], allelic_series = config, allelic_effects = c(-30, 30), error_variance = 1)
tr20 <- reducedscan::sim1(aprobs = geno$`1`[, , 1000], allelic_series = config, allelic_effects = c(-20, 20), error_variance = 1)
tr10 <- reducedscan::sim1(aprobs = geno$`1`[, , 1000], allelic_series = config, allelic_effects = c(-10, 10), error_variance = 1)
tr3 <- reducedscan::sim1(aprobs = geno$`1`[, , 1000], allelic_series = config, allelic_effects = c(-3, 3), error_variance = 1)
set.seed(2020-02-10)
out30 <- reducedscan::jannink_mcmc(niter = 10000, 
                                      initial_values = list(configuration = config, 
                                                            effects = c(-10, 10), 
                                                            residual_variance = 1), 
                                      genoprobs = geno$`1`[ , , 1000], 
                                      trait = tr30, 
                                      allelic_number_prior = "poisson", 
                                      poisson_prior_mean = 2)
set.seed(2020-02-10)
out20 <- reducedscan::jannink_mcmc(niter = 10000, 
                                      initial_values = list(configuration = config, 
                                                            effects = c(-10, 10), 
                                                            residual_variance = 1), 
                                      genoprobs = geno$`1`[ , , 1000], 
                                      trait = tr20, 
                                      allelic_number_prior = "poisson", 
                                      poisson_prior_mean = 2)
set.seed(2020-02-10)
out10 <- reducedscan::jannink_mcmc(niter = 10000, 
                                      initial_values = list(configuration = config, 
                                                            effects = c(-10, 10), 
                                                            residual_variance = 1), 
                                      genoprobs = geno$`1`[ , , 1000], 
                                      trait = tr10, 
                                      allelic_number_prior = "poisson", 
                                      poisson_prior_mean = 2)
out3 <- reducedscan::jannink_mcmc(niter = 10000, 
                                      initial_values = list(configuration = config, 
                                                            effects = c(-10, 10), 
                                                            residual_variance = 1), 
                                      genoprobs = geno$`1`[ , , 1000], 
                                      trait = tr3, 
                                      allelic_number_prior = "poisson", 
                                      poisson_prior_mean = 2)

Open questions about the inferences

  1. Role of starting values
  2. residual variance
  3. configuration
  4. allelic number
  5. effects
  6. Role of true effects
  7. Role of poisson prior mean hyperparameter
  8. How do mistaken inferences in configuration affect statistical power in QTL scans?
  9. Too many alleles, but otherwise reasonable groupings of founders
  10. Too few alleles
  11. Too many alleles and unreasonable groupings of founders


fboehm/reducedscan documentation built on April 30, 2021, 8:31 p.m.