Description Usage Arguments Value Examples
View source: R/mcmc_functions.R
This function runs the BTUN with Gender Effect MCMC algorithm
1 2 3 4 5 6 7 8 9 10 | run_gender_mcmc(
n.iter,
delta,
k.mean,
k.chol,
male.win.matrix,
female.win.matrix,
f.initial,
g.initial
)
|
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, alpha must be set to 1 when constructing ths |
male.win.matrix |
A matrix, where w_ij give the number of times area i beat j when judged by men |
female.win.matrix |
A matrix, where w_ij give the number of times area i beat j when judged by women |
f.initial |
A vector of the intial esitmate for f, the male function |
g.initial |
A vector of the intial esitmate for g, the discrepancy functon |
A list of MCMC output
f.matrix - A matrix containing the each iteration of f
g.matrix - A matrix containing the each iteration of g
alpha.sq - A matrix containing the iterations of alpha^2
accpetance.rate - The acceptance rate for f and g
time.taken - Time tkane to run the MCMC algorithm in seconds
1 2 3 4 5 6 7 8 9 10 11 12 13 | n.iter <- 10
delta <- 0.1
k.mean <- c(0, 0, 0)
k.chol <- diag(3)
men.comparisons <- data.frame("winner" = c(1, 3, 2, 2), "loser" = c(3, 1, 1, 3))
women.comparisons <- data.frame("winner" = c(1, 2, 1, 2), "loser" = c(3, 1, 3, 3))
men.win.matrix <- comparisons_to_matrix(3, men.comparisons)
women.win.matrix <- comparisons_to_matrix(3, women.comparisons)
f.initial <- c(0, 0, 0)
g.initial <- c(0, 0, 0)
mcmc.output <- run_gender_mcmc(n.iter, delta, k.mean, k.chol, men.win.matrix,
women.win.matrix, f.initial, g.initial)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.