```
<- c("MASS", "Rtools", "remotes")
pkgs <- c("https://cran.rstudio.com", "https://inla.r-inla-download.org/R/stable")
repos install.packages(pkgs, repos=repos, dependencies = "Depends")
```

# bmhe: A utility package for post-processing of Bayesian models performed in `OpenBUGS`

or `JAGS`

Bayesian statistics

R

## Introduction

This utility package consists of a series of functions that can be used to post-process the output of Bayesian models (obtained using `OpenBUGS`

or `JAGS`

). There are mainly three sets of different functions.

### Plotting

`betaplot`

Trial-and-error Beta plot (using`manipulate`

)`coefplot`

“Coefplot” for the parameters in the model (using`tidyverse`

)`diagplot`

Specialised diagnostic plots to check convergence and autocorrelation of the MCMC run`gammaplot`

Trial-and-error Gamma plot (using`manipulate`

)`posteriorplot`

Various plots for the posteriors in a ‘`bugs`

’ or ‘`jags`

’ object`traceplot`

Makes a traceplot (eg to visualise MCMC simulations from multiple chains, using`tidyverse`

)

### Printing

`print.bugs`

Modifies the built-in print method for the`R2OpenBUGS`

package to provide a few more options and standardisation`print.rjags`

Modifies the built-in print method for the`R2jags`

package to provide a few more options and standardisation`stats`

Computes and prints summary statistics for a vector or matrix of simulated values

### Utility

`betaPar`

Computes the parameters of a Beta distribution so that the mean and standard dev are the input`(m,s)`

`betaPar2`

Compute the parameters of a Beta distribution, given a prior guess for key parameters. Based on “Bayesian ideas and data analysis”, page 100. Optimisation method to identify the values of`(a,b)`

that give required conditions on the Beta distribution`ilogit`

Computes the inverse logit of a number between \(-\infty\) and \(\infty\)`logit`

Computes the logit of a number`lognPar`

Computes mean and variance of a logNormal distribution so that the parameters on the natural scale are`mu`

and`sigma`

`odds2probs`

Maps from odds to probabilities`OR`

Computes the odds ratio between two probabilities

## Installation

The package is only available from its `GitHub`

repository. On `Windows`

machines, you need to install a few dependencies, including Rtools first, e.g. by running

before installing the package using `remotes`

:

`::install_github("giabaio/BCEA", ref="dev") remotes`

Under `Linux`

or `MacOS`

, it is sufficient to install the package via `remotes`

:

```
install.packages("remotes")
::install_github("giabaio/BCEA", ref="dev") remotes
```

Once installed, the package can be called using the `library`

command

`library(bmhe)`

and its functions used accordingly.