Description Usage Arguments Value Examples

View source: R/mcmc_functions.R

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`

.

1 2 3 4 5 6 7 8 9 10 |

`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 |

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

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)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.