run_mcmc: Run the BSBT MCMC algorithm

Description Usage Arguments Value Examples

View source: R/mcmc_functions.R

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 area and the prior distribution variance parameter. For data with two types of judges, see run_gender_mcmc.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
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 area 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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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 March 15, 2021, 1:07 a.m.