Learn R Programming

⚠️There's a newer version (0.1.8) of this package.Take me there.

BayesianTools (version 0.1.7)

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

978

Version

0.1.7

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Florian Hartig

Last Published

December 9th, 2019

Functions in BayesianTools (0.1.7)

AdaptpCR

Adapts pCR values
DREAMzs

DREAMzs
createPriorDensity

Fits a density function to a multivariate sample
DREAM

DREAM
betaFun

Helper function for calculating beta
DIC

Deviance information criterion
DEzs

Differential-Evolution MCMC zs
getBlock

Determine the parameters in the block update
BayesianTools

BayesianTools
DE

Differential-Evolution MCMC
convertCoda

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

Very simple ecosystem model
createProposalGenerator

Factory that creates a proposal generator
VSEMcreateLikelihood

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

Create a random radiation (PAR) time series
TwalkMove

Wrapper for step function
createBetaPrior

Convenience function to create a beta prior
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
DR

The Delayed Rejection Algorithm
getPredictiveIntervals

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

Main function that is executing and evaluating the moves
M

The Metropolis Algorithm
MAP

calculates the Maxiumum APosteriori value (MAP)
getMetropolisDefaultSettings

Returns Metropolis default settings
bridgesample

Calculates the marginal likelihood of a chain via bridge sampling
smcSampler

SMC sampler
createUniformPrior

Convenience function to create a simple uniform prior distribution
getRmvnorm

Produce multivariate normal proposal
factorMatrice

factorMatrice
setupStartProposal

Help function to find starvalues and proposalGenerator settings
getVolume

Calculate posterior volume
Gfun

Helper function for blow and hop moves
DRAM

The Delayed Rejection Adaptive Metropolis Algorithm
combineChains

Function to combine chains
createPosterior

Creates a standardized posterior class
VSEMgetDefaults

returns the default values for the VSEM
Metropolis

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

Calculates the panel combination for par(mfrow = )
gelmanDiagnostics

Runs Gelman Diagnotics over an BayesianOutput
createMcmcSamplerList

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

Creates a standardized likelihood class#'
propFun

Helper function to create proposal
generateCRvalues

Generates matrix of CR values based on pCR
testDensityNormal

Normal likelihood
likelihoodAR1

AR1 type likelihood function
createMixWithDefaults

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

Function to scale matrices
sampleMetropolis

gets samples while adopting the MCMC proposal generator
checkBayesianSetup

Checks if an object is of class 'BayesianSetup'
calibrationTest

Simulation-based calibration tests
testDensityBanana

Banana-shaped density function
testDensityMultiNormal

3d Mutivariate Normal likelihood
plotDiagnostic

Diagnostic Plot
createPrior

Creates a standardized prior class
generateParallelExecuter

Factory to generate a parallel executer of an existing function
getSample

Extracts the sample from a bayesianOutput
rescale

Rescale
marginalPlotViolin

Plot marginals as violin plot
mcmcMultipleChains

Run multiple chains
getDharmaResiduals

Creates a DHARMa object
getBlockSettings

getblockSettings
plotTimeSeriesResiduals

Plots residuals of a time series
createTruncatedNormalPrior

Convenience function to create a truncated normal prior
generateTestDensityMultiNormal

Multivariate normal likelihood
testLinearModel

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

Performs a one-factor-at-a-time sensitivity analysis for the posterior of a given bayesianSetup within the prior range.
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
makeObjectClassCodaMCMC

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

Test function infinity ragged
createBayesianSetup

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

T-walk MCMC
getPredictiveDistribution

Calculates predictive distribution based on the parameters
stopParallel

Function to close cluster in BayesianSetup
marginalPlot

Plot MCMC marginals
marginalPlotDensity

Plot marginals as densities
plotTimeSeriesResults

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

Returns possible sampler types
thinMatrix

Function to thin matrices
tracePlot

Trace plot for MCMC class
updateGroups

Determine the groups of correlated parameters
sumSquare

Helper function for sum of x*x
applySettingsDefault

Provides the default settings for the different samplers in runMCMC
correlationPlot

Flexible function to create correlation density plots
WAIC

calculates the WAIC
correctThin

Checks if thin is conistent with nTotalSamples samples and if not corrects it.
mergeChains

Merge Chains
runMCMC

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

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

Normal / Gaussian Likelihood function
updateProposalGenerator

To update settings of an existing proposal genenerator
vsemC

C version of the VSEM model
metropolisRatio

Function to calculate the metropolis ratio
getSetup

Function to get the setup from a bayesianOutput
logSumExp

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

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

The Adaptive Metropolis Algorithm
getCredibleIntervals

Calculate confidence region from an MCMC or similar sample