Gibbs sampler under the alternative of non-random mating using genotype log-likelihoods.

gibbs_gl_alt(
  gl,
  beta,
  B = 10000L,
  T = 1000L,
  more = FALSE,
  lg = FALSE,
  verbose = TRUE
)

Arguments

gl

The matrix of genotype log-likelihoods. The columns index the dosages and the rows index the individuals. gl[i,j] is the genotype log-likelihood for individual i at dosage j. It is assumed that natural log is used.

beta

The concentration hyperparameter for the genotype frequencies.

B

The number of sampling iterations.

T

The number of burn-in iterations.

more

A logical. Should we also return posterior draws (TRUE) or not (FALSE).

lg

Should we return the log marginal likelihood (true) or not (false).

verbose

A logical. Should we print the progress?

Value

A list with some or all of the following elements

  • mx: The estimate of the marginal likelihood

Author

David Gerard

Examples

set.seed(1)
ploidy <- 8

## Simulate under the alternative
q <- stats::runif(ploidy + 1)
q <- q / sum(q)
nvec <- c(stats::rmultinom(n = 1, size = 100, prob = q))
gl <- simgl(nvec)

gibbs_gl_alt(gl = gl, beta = rep(1, ploidy + 1), lg = TRUE)
#> Sampling for general model using genotype likelihoods
#> Iteration: 0 / 11000 (Warmup)
#> Iteration: 1100 / 11000 (Sampling)
#> Iteration: 2200 / 11000 (Sampling)
#> Iteration: 3300 / 11000 (Sampling)
#> Iteration: 4400 / 11000 (Sampling)
#> Iteration: 5500 / 11000 (Sampling)
#> Iteration: 6600 / 11000 (Sampling)
#> Iteration: 7700 / 11000 (Sampling)
#> Iteration: 8800 / 11000 (Sampling)
#> Iteration: 9900 / 11000 (Sampling)
#> $mx
#> [1] -237.4706
#>