Learn R Programming

BayesianTools (version 0.1.8)

General-Purpose MCMC and SMC Samplers and Tools for Bayesian Statistics

Description

General-purpose MCMC and SMC samplers, as well as plot and diagnostic functions for Bayesian statistics, with a particular focus on calibrating complex system models. Implemented samplers include various Metropolis MCMC variants (including adaptive and/or delayed rejection MH), the T-walk, two differential evolution MCMCs, two DREAM MCMCs, and a sequential Monte Carlo (SMC) particle filter.

Copy Link

Version

Install

install.packages('BayesianTools')

Monthly Downloads

998

Version

0.1.8

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Florian Hartig

Last Published

January 30th, 2023

Functions in BayesianTools (0.1.8)

WAIC

calculates the WAIC
applySettingsDefault

Provides the default settings for the different samplers in runMCMC
calibrationTest

Simulation-based calibration tests
Gfun

Helper function for blow and hop moves
checkBayesianSetup

Checks if an object is of class 'BayesianSetup'
bridgesample

Calculates the marginal likelihood of a chain via bridge sampling
createPriorDensity

Fits a density function to a multivariate sample
convertCoda

Convert coda::mcmc objects to BayesianTools::mcmcSampler
createLikelihood

Creates a standardized likelihood class#'
createMcmcSamplerList

Convenience function to create an object of class mcmcSamplerList from a list of mcmc samplers
createProposalGenerator

Factory that creates a proposal generator
combineChains

Function to combine chains
betaFun

Helper function for calculating beta
VSEMcreatePAR

Create a random radiation (PAR) time series
correctThin

Checks if thin is consistent with nTotalSamples samples and if not corrects it.
correlationPlot

Flexible function to create correlation density plots
VSEMgetDefaults

returns the default values for the VSEM
createBayesianSetup

Creates a standardized collection of prior, likelihood and posterior functions, including error checks etc.
createSmcSamplerList

Convenience function to create an object of class SMCSamplerList from a list of mcmc samplers
getBlockSettings

getblockSettings
generateParallelExecuter

Factory to generate a parallel executor of an existing function
generateTestDensityMultiNormal

Multivariate normal likelihood
createBetaPrior

Convenience function to create a beta prior
getBlock

Determine the parameters in the block update
createUniformPrior

Convenience function to create a simple uniform prior distribution
getPredictiveIntervals

Calculates Bayesian credible (confidence) and predictive intervals based on parameter sample
getPanels

getPanels
getPredictiveDistribution

Calculates predictive distribution based on the parameters
getDharmaResiduals

Creates a DHARMa object
createTruncatedNormalPrior

Convenience function to create a truncated normal prior
getCredibleIntervals

Calculate confidence region from an MCMC or similar sample
getPossibleSamplerTypes

Returns possible sampler types
createPrior

Creates a standardized prior class
gelmanDiagnostics

Gelman Diagnostics
getSetup

Function to get the setup from a bayesianOutput
createPosterior

Creates a standardized posterior class
getSample

Extracts the sample from a bayesianOutput
getRmvnorm

Produce multivariate normal proposal
generateCRvalues

Generates matrix of CR values based on pCR
factorMatrice

factorMatrice
marginalPlotDensity

Plot marginals as densities
mcmcMultipleChains

Run multiple chains
likelihoodIidNormal

Normal / Gaussian Likelihood function
getVolume

Calculate posterior volume
marginalPlotViolin

Plot marginals as violin plot
plotDiagnostic

Diagnostic Plot
likelihoodAR1

AR1 type likelihood function
plotSensitivity

Performs a one-factor-at-a-time sensitivity analysis for the posterior of a given bayesianSetup within the prior range.
marginalPlot

Plot MCMC marginals
marginalLikelihood

Calcluated the marginal likelihood from a set of MCMC samples
plotTimeSeries

Plots a time series, with the option to include confidence and prediction band
metropolisRatio

Function to calculate the metropolis ratio
mergeChains

Merge Chains
logSumExp

Funktion to compute log(sum(exp(x))
createMixWithDefaults

Allows to mix a given parameter vector with a default parameter vector
smcSampler

SMC sampler
plotTimeSeriesResults

Creates a time series plot typical for an MCMC / SMC fit
propFun

Helper function to create proposal
sampleEquallySpaced

Gets n equally spaced samples (rows) from a matrix or vector
makeObjectClassCodaMCMC

Helper function to change an object to a coda mcmc class,
runMCMC

Main wrapper function to start MCMCs, particle MCMCs and SMCs
rescale

Rescale
scaleMatrix

Function to scale matrices
testDensityMultiNormal

3d Mutivariate Normal likelihood
testDensityNormal

Normal likelihood
testDensityGelmanMeng

GelmanMeng test function
testDensityInfinity

Test function infinity ragged
setupStartProposal

Help function to find starvalues and proposalGenerator settings
updateProposalGenerator

To update settings of an existing proposal genenerator
sampleMetropolis

gets samples while adopting the MCMC proposal generator
updateGroups

Determine the groups of correlated parameters
tracePlot

Trace plot for MCMC class
stopParallel

Function to close cluster in BayesianSetup
testDensityBanana

Banana-shaped density function
plotTimeSeriesResiduals

Plots residuals of a time series
sumSquare

Helper function for sum of x*x
vsemC

C version of the VSEM model
testLinearModel

Fake model, returns a ax + b linear response to 2-param vector
thinMatrix

Function to thin matrices
DR

The Delayed Rejection Algorithm
DREAMzs

DREAMzs
DREAM

DREAM
DEzs

Differential-Evolution MCMC zs
BayesianTools

BayesianTools
AM

The Adaptive Metropolis Algorithm
DRAM

The Delayed Rejection Adaptive Metropolis Algorithm
AdaptpCR

Adapts pCR values
DIC

Deviance information criterion
M

The Metropolis Algorithm
MAP

calculates the Maxiumum APosteriori value (MAP)
VSEM

Very simple ecosystem model
VSEMcreateLikelihood

Create an example dataset, and from that a likelihood or posterior for the VSEM model
GOF

Standard GOF metrics Startvalues for sampling with nrChains > 1 : if you want to provide different start values for the different chains, provide a list
Twalksteps

Main function that is executing and evaluating the moves
DE

Differential-Evolution MCMC
TwalkMove

Wrapper for step function
Twalk

T-walk MCMC
Metropolis

Creates a Metropolis-type MCMC with options for covariance adaptatin, delayed rejection, Metropolis-within-Gibbs, and tempering