run_mcmc: Run the BSBT MCMC algorithm

View source: R/mcmc_functions.R

run_mcmcR Documentation

Run the BSBT MCMC algorithm

Description

This function runs the BSBT MCMC algorithm to estimate the deprivation parameters. In this version, the judges are assumed to act homogeneously. This algorithm estimates the deprivation in each object and the prior distribution variance parameter. For data with two types of judges, see run_symmetric_mcmc.

Usage

run_mcmc(
  n.iter,
  delta,
  covariance.matrix,
  win.matrix,
  f.initial,
  alpha = FALSE,
  omega = 0.1,
  chi = 0.1
)

Arguments

n.iter

The number of iterations to be run

delta

The underrlaxed tuning parameter must be in (0, 1)

covariance.matrix

The output from the covariance matrix function, which contains the decomposed and inverted covariance matrix.

win.matrix

A matrix, where w_ij give the number of times object i beat j

f.initial

A vector of the initial estimate for f

alpha

A boolean if inference for alpha should be carried out. If this is TRUE, the covariance matrix

omega

The value of the inverse gamma shape parameter

chi

The value of the inverse gamma scale parameter

Value

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

  • acceptance.rate - The acceptance rate for f

  • time.taken - Time taken to run the MCMC algorithm in seconds

Examples


n.iter <- 10
delta <- 0.1
covariance.matrix <- list()
covariance.matrix$mean <- c(0, 0, 0)
covariance.matrix$decomp <- diag(3)
covariance.matrix$inv    <- diag(3)
comparisons <- data.frame("winner" = c(1, 3, 2, 2), "loser" = c(3, 1, 1, 3))
win.matrix <- comparisons_to_matrix(3, comparisons) #construct covariance matrix
f.initial <- c(0, 0, 0) #initial estimates for lamabda_1, lambda_2, lambda_3

mcmc.output <- run_mcmc(n.iter, delta, covariance.matrix, win.matrix, f.initial)



BSBT documentation built on Aug. 9, 2022, 5:06 p.m.