tests/testthat/test-runMCMC.R

context("Test runMCMC interface")

set.seed(1)
library(BayesianTools)
library(testthat)


ll <- function(x) sum(dnorm(x, log = T))
bayesianSetup <- createBayesianSetup(likelihood = ll, lower = rep(-10, 4), upper = rep(10, 4))

settings = list(iterations = 5)
out <- runMCMC(bayesianSetup = bayesianSetup, settings = settings)

x = gelmanDiagnostics(out)
summary(out)


settings = list(iterations = 10, nrChains = 3)
out <- runMCMC(bayesianSetup = bayesianSetup, settings = settings)
gelmanDiagnostics(out)
summary(out)


expect_error(runMCMC(bayesianSetup = ll, settings = settings))

Try the BayesianTools package in your browser

Any scripts or data that you put into this service are public.

BayesianTools documentation built on Dec. 10, 2019, 1:08 a.m.