Learn R Programming

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

BayesianTools (version 0.1.6)

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.6

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Florian Hartig

Last Published

January 21st, 2019

Functions in BayesianTools (0.1.6)

scaleMatrix

Function to scale matrices
marginalPlot

Plot MCMC marginals
createLikelihood

Creates a standardized likelihood class#'
sampleMetropolis

gets samples while adopting the MCMC proposal generator
VSEMcreatePAR

Create a random radiation (PAR) time series
getDharmaResiduals

Creates a DHARMa object
Metropolis

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

Determine the groups of correlated parameters
sampleEquallySpaced

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

Very simple ecosystem model
calibrationTest

Simulation-based calibration tests
getSample

Extracts the sample from a bayesianOutput
DEzs

Differential-Evolution MCMC zs
DIC

Deviance information criterion
getBlockSettings

getblockSettings
checkBayesianSetup

Checks if an object is of class 'BayesianSetup'
getCredibleIntervals

Calculate confidence region from an MCMC or similar sample
VSEMgetDefaults

returns the default values for the VSEM
createMcmcSamplerList

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

BayesianTools
getRmvnorm

Produce multivariate normal proposal
tracePlot

Trace plot for MCMC class
marginalLikelihood

Calcluated the marginal likelihood from a set of MCMC samples
getBlock

Determine the parameters in the block update
plotTimeSeriesResults

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

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

T-walk MCMC
betaFun

Helper function for calculating beta
DE

Differential-Evolution MCMC
M

The Metropolis Algorithm
marginalPlotDensity

Plot marginals as densities
createSmcSamplerList

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

Convenience function to create a truncated normal prior
MAP

calculates the Maxiumum APosteriori value (MAP)
plotTimeSeriesResiduals

Plots residuals of a time series
getSetup

Function to get the setup from a bayesianOutput
createPosterior

Creates a standardized posterior class
createPrior

Creates a standardized prior class
generateParallelExecuter

Factory to generate a parallel executer of an existing function
generateTestDensityMultiNormal

Multivariate normal likelihood
DR

The Delayed Rejection Algorithm
createUniformPrior

Convenience function to create a simple uniform prior distribution
TwalkMove

Wrapper for step function
AM

The Adaptive Metropolis Algorithm
getPredictiveIntervals

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

Returns possible sampler types
getPredictiveDistribution

Calculates predictive distribution based on the parameters
AdaptpCR

Adapts pCR values
marginalPlotViolin

Plot marginals as violin plot
mcmcMultipleChains

Run multiple chains
VSEMcreateLikelihood

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

Merge Chains
metropolisRatio

Function to calculate the metropolis ratio
setupStartProposal

Help function to find starvalues and proposalGenerator settings
correlationPlot

Flexible function to create correlation density plots
runMCMC

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

Returns Metropolis default settings
smcSampler

SMC sampler
testLinearModel

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

DREAM
DREAMzs

DREAMzs
Twalksteps

Main function that is executing and evaluating the moves
createBayesianSetup

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

Function to thin matrices
bridgesample

Calculates the marginal likelihood of a chain via bridge sampling
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
DRAM

The Delayed Rejection Adaptive Metropolis Algorithm
Gfun

Helper function for blow and hop moves
WAIC

calculates the WAIC
correctThin

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

Banana-shaped density function
likelihoodAR1

AR1 type likelihood function
applySettingsDefault

Provides the default settings for the different samplers in runMCMC
createPriorDensity

Fits a density function to a multivariate sample
createBetaPrior

Convenience function to create a beta prior
createProposalGenerator

Factory that creates a proposal generator
factorMatrice

factorMatrice
likelihoodIidNormal

Normal / Gaussian Likelihood function
getVolume

Calculate posterior volume
combineChains

Function to combine chains
logSumExp

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

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

Helper function to create proposal
convertCoda

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

Rescale
testDensityMultiNormal

3d Mutivariate Normal likelihood
testDensityNormal

Normal likelihood
plotDiagnostic

Diagnostic Plot
gelmanDiagnostics

Runs Gelman Diagnotics over an BayesianOutput
testDensityInfinity

Test function infinity ragged
generateCRvalues

Generates matrix of CR values based on pCR
plotSensitivity

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

Calculates the panel combination for par(mfrow = )
plotTimeSeries

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

Function to close cluster in BayesianSetup
sumSquare

Helper function for sum of x*x
updateProposalGenerator

To update settings of an existing proposal genenerator
vsemC

C version of the VSEM model