Description Usage Arguments Value Examples
View source: R/mcmc_functions.R
This function runs the BTUN mcmc algorithm with ordering constraints. The constraints are included using a list of sets.
1 2 3 4 5 6 7 8 9 10 | run_mcmc_with_ordering(
n.iter,
delta,
k.mean,
k.chol,
win.matrix,
f.initial,
S,
alpha = FALSE
)
|
n.iter |
The number of iterations to be run |
delta |
The underrlaxed tuning parameter must be in (0, 1) |
k.mean |
The GP prior mean vector |
k.chol |
The cholesky decomposition of the GP prior covariance matrix |
win.matrix |
A matrix, where w_ij give the number of times area i beat j |
f.initial |
A vector of the intial esitmate for f |
S |
A list of ordering constraints. There are four elements in each set, the label of the two areas, the value of the constaint, and the confidence parameter. |
alpha |
A boolean if inference for alpha should be carried out |
A list of MCMC output
f.matrix - A matrix containing the each iteration of f
alpha.sq - A vector containing the iterations of alpha^2
accpetance.rate - The acceptance rate for f
time.taken - Time tkane to run the MCMC algorithm in seconds
1 2 3 4 5 6 7 8 9 10 11 | n.iter <- 10
delta <- 0.1
k.mean <- c(0, 0, 0)
k.chol <- diag(3)
comparisons <- data.frame("winner" = c(1, 3, 2, 2), "loser" = c(3, 1, 1, 3))
win.matrix <- comparisons_to_matrix(3, comparisons)
f.initial <- c(0, 0, 0)
S <- list()
S[[1]] <- c(1, 3, -1, 3)
S[[2]] <- c(1, 2, -1, 3)
mcmc.output <- run_mcmc_with_ordering(n.iter, delta, k.mean, k.chol, win.matrix, f.initial, S)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.