R/calculate_Rhat.R
calculate_Rhat.RdThis function applies MCMC outputs from the mcmc_RCMVN package to the gelman.diag function in the coda package.
calculate_Rhat(mcmc, names = NULL, confidence = 0.95, multivariate = FALSE)MCMC draws from the RaCE NMA model, in the form of the model output of the mcmc_RCMVN function.
A vector of intervention names (optional)
The confidence parameter from the gelman.diag function in the coda package. Defaults to 0.95.
The multivariate parameter from the gelman.diag function in the coda package. Defaults to FALSE.
Gelman diagnostics for the inputted MCMC chains, in the format of the output of the gelman.diag function in the coda package.
mcmc <- mcmc_RCMVN(ybar=c(0,0,1,1), s=c(.1,.1,.1,.1), mu0=0.5, sigma0=5, tau=0.5,chains=2,seed=1)
#> [1] "Estimating chain 1 of 2."
#> [1] "Estimating chain 2 of 2."
calculate_Rhat(mcmc,names=paste0("Treatment ",1:4))
#> Potential scale reduction factors:
#>
#> Point est. Upper C.I.
#> Treatment 1 1 1
#> Treatment 2 1 1
#> Treatment 3 1 1
#> Treatment 4 1 1
#>