florianhartig / BayesianTools

General-Purpose MCMC and SMC Samplers and Tools for Bayesian Statistics
https://cran.r-project.org/web/packages/BayesianTools/index.html
115 stars 29 forks source link

1-d MCMC outputs #222

Closed florianhartig closed 1 year ago

florianhartig commented 3 years ago

Based on #221 - check that all functions also work for 1-d MCMC outputs

RobertBosek commented 2 years ago

after fixing matrix subsetting in marginalLikelihood.R and plotMarginals.R functions should work for one parameter MCMC-samplers

tested with:

ll <- function(x) sum(dnorm(x, log = TRUE))
setup <- createBayesianSetup(ll, lower = -100, upper = 100)
out <- runMCMC(bayesianSetup = setup, sampler = x, settings = list(iterations=1000))

used "Metropolis", "AM", "DR", "DRAM", "DE", "DEzs", "DREAM", "DREAMzs", "Twalk" samplers as x

tested functions print, getSample, summary, plot, DIC, MAP, getVolume, marginalLikelihood, marginalPlot, tracePlot work for all samplers

WAIC, gelmanDiagnostics also work for samplers with multiple internal chains ("DE", "DEzs", "DREAM", "DREAMzs", "Twalk")

correlationPlot correctly exits with warning message:

Error in correlationPlot(out) : 
  BayesianTools::correlationPlot - using this function only makes sense if you have more than 1 parameter