tracePlot: Trace plot for MCMC class

Description Usage Arguments See Also Examples

View source: R/plotTrace.R

Description

Trace plot for MCMC class

Usage

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# 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)

Example output

sh: 1: cannot create /dev/null: Permission denied
sh: 1: cannot create /dev/null: Permission denied
BT runMCMC: trying to find optimal start and covariance values BT runMCMC: Optimization finished, setting startValues to 0.000379936060707203 0.00105970825386049  - Setting covariance to 0.999974257681667 -2.61443857405355e-08 -2.61443857405355e-08 1.00000004747326 

 Running Metropolis-MCMC, chain  1 iteration 100 of 2000 . Current logp:  -8.016561  Please wait! 

 Running Metropolis-MCMC, chain  1 iteration 200 of 2000 . Current logp:  -11.70422  Please wait! 

 Running Metropolis-MCMC, chain  1 iteration 300 of 2000 . Current logp:  -7.834444  Please wait! 

 Running Metropolis-MCMC, chain  1 iteration 400 of 2000 . Current logp:  -8.405972  Please wait! 

 Running Metropolis-MCMC, chain  1 iteration 500 of 2000 . Current logp:  -8.328411  Please wait! 

 Running Metropolis-MCMC, chain  1 iteration 600 of 2000 . Current logp:  -12.57339  Please wait! 

 Running Metropolis-MCMC, chain  1 iteration 700 of 2000 . Current logp:  -8.144032  Please wait! 

 Running Metropolis-MCMC, chain  1 iteration 800 of 2000 . Current logp:  -8.532652  Please wait! 

 Running Metropolis-MCMC, chain  1 iteration 900 of 2000 . Current logp:  -9.201686  Please wait! 

 Running Metropolis-MCMC, chain  1 iteration 1000 of 2000 . Current logp:  -8.547287  Please wait! 

 Running Metropolis-MCMC, chain  1 iteration 1100 of 2000 . Current logp:  -10.6967  Please wait! 

 Running Metropolis-MCMC, chain  1 iteration 1200 of 2000 . Current logp:  -8.231569  Please wait! 

 Running Metropolis-MCMC, chain  1 iteration 1300 of 2000 . Current logp:  -8.896281  Please wait! 

 Running Metropolis-MCMC, chain  1 iteration 1400 of 2000 . Current logp:  -10.92747  Please wait! 

 Running Metropolis-MCMC, chain  1 iteration 1500 of 2000 . Current logp:  -8.029764  Please wait! 

 Running Metropolis-MCMC, chain  1 iteration 1600 of 2000 . Current logp:  -8.170683  Please wait! 

 Running Metropolis-MCMC, chain  1 iteration 1700 of 2000 . Current logp:  -8.949206  Please wait! 

 Running Metropolis-MCMC, chain  1 iteration 1800 of 2000 . Current logp:  -8.523224  Please wait! 

 Running Metropolis-MCMC, chain  1 iteration 1900 of 2000 . Current logp:  -9.458584  Please wait! 

 Running Metropolis-MCMC, chain  1 iteration 2000 of 2000 . Current logp:  -11.09482  Please wait! 
runMCMC terminated after 1.045seconds

BayesianTools documentation built on Dec. 10, 2019, 1:08 a.m.