tracePlot: Trace plot for MCMC class

View source: R/plotTrace.R

tracePlotR Documentation

Trace plot for MCMC class

Description

Trace plot for MCMC class

Usage

tracePlot(sampler, thin = "auto", ...)

Arguments

sampler

an object of class MCMC sampler

thin

determines the thinning intervall of the chain

...

additional parameters to pass on to the getSample, for example parametersOnly =F, or start = 1000

See Also

marginalPlot
plotTimeSeries
correlationPlot

Examples

# set up and run the MCMC
ll <- function(x) sum(dnorm(x, log = TRUE))
setup <- createBayesianSetup(likelihood = ll, lower = c(-10, -10), upper = c(10,10))
settings <- list(iterations = 2000)
out <- runMCMC(bayesianSetup = setup, settings = settings, sampler = "Metropolis")

# plot the trace
tracePlot(sampler = out, thin = 10)
tracePlot(sampler = out, thin = 50)

# additional parameters can be passed on to getSample (see help)
tracePlot(sampler = out, thin = 10, start = 500)
# select parameter by index
tracePlot(sampler = out, thin = 10, start = 500, whichParameters = 2)

BayesianTools documentation built on Feb. 16, 2023, 8:44 p.m.