Rev Language Reference


srMinESS - Estimated sample size stopping rule

Allow an MCMC run to terminate once the specified criterion has been met.

Usage

srMinESS(RealPos minEss, String filename, Natural frequency, String burninMethod)

Arguments

minEss : RealPos (pass by value)
The minimum ESS threshold when stopping is allowed.
filename : String (pass by value)
The name of the file containing the samples.
frequency : Natural (pass by value)
The frequency how often to check for convergence.
Default : 10000
burninMethod : String (pass by value)
Which type of burnin method to use.
Default : ESS
Options : ESS|SEM

Details

The Effective Sample Size (ESS) is the number of independent samples generated by a MCMC sampler. The ESS takes into account the correlation between samples within a chain. Low ESS values represent high autocorrelation in the chain. If the autocorrelation is higher, then the uncertainty in our estimates is also higher. The MCMC run will terminate once all parameters in every log file meet the ESS threshold. As such, performing additional runs will not decrease the number of generations required to meet the ESS threshold – even though it will increase the number of indepedent samples in the final, pooled posterior sample.

Example

Binomial example: estimate success probability given 7 successes out of 20 trials

r ~ dnExp(10) p := Probability(ifelse(r < 1, r, 1)) n <- 20 k ~ dnBinomial(n, p) k.clamp(7) mymodel = model(k)

moves = VectorMoves() moves.append( mvSlide(r, delta=0.1, weight=1) )

paramFile = “parameters.log”

monitors = VectorMonitors() monitors.append( mnModel(filename=paramFile, printgen=100, p) )

Stop when all monitored parameters have attained an estimated sample size of 50

stopping_rules[1] = srMinESS(50, file = paramFile, freq = 1000)

Create the MCMC object

mymcmc = mcmc(mymodel, monitors, moves)

Begin the MCMC run

mymcmc.run(rules = stopping_rules)

See Also