Learn R Programming

EMC (version 1.1)

findMaxTemper: Find the maximum temperature for parallel MCMC chains

Description

Multiple MCMC chains based algorithms (e.g., parallel tempering, evolutionary Monte Carlo) need a temperature ladder. This function finds the maximum temperature for constructing the ladder.

Usage

findMaxTemper(nIters,
              statsFuncList,
              startingVals,
              logTarDensFunc,
              MHPropNewFunc,
              logMHPropDensFunc = NULL, 
              temperLadder      = NULL,
              temperLimits      = NULL,
              ladderLen         = 10,
              scheme            = 'exponential',
              schemeParam       = 0.5,
              cutoffDStats      = 1.96,
              cutoffESS         = 50,
              guideMe           = TRUE,
              levelsSaveSampFor = NULL,
              saveFitness       = FALSE,
              doFullAnal        = TRUE,
              verboseLevel      = 0,
              ...)

Arguments

nIters
integer $>$ 0.
statsFuncList
list of functions of one argument each, which return the value of the statistic evaluated at one MCMC sample or draw.
startingVals
double matrix of dimension temperLadderLen $\times$ sampDim or vector of length sampDim, in which case the same starting values are used for every temperature level.
logTarDensFunc
function of two arguments (draw, ...) that returns the target density evaluated in the log scale.
MHPropNewFunc
function of four arguments (temperature, block, currentDraw, ...) that returns new Metropolis-Hastings proposals. See details below on the argument block.
logMHPropDensFunc
function of five arguments (temperature, block, currentDraw, proposalDraw, ...) that returns the proposal density evaluated in the log scale. See details below on the argument block.
temperLadder
double vector with all positive entries, in decreasing order.
temperLimits
double vector with two positive entries.
ladderLen
integer $>$ 0.
scheme
character.
schemeParam
double $>$ 0.
cutoffDStats
double $>$ 0.
cutoffESS
double $>$ 0.
guideMe
logical.
levelsSaveSampFor
integer vector with positive entries.
saveFitness
logical.
doFullAnal
logical.
verboseLevel
integer, a value $\ge$ 2 produces a lot of output.
...
optional arguments to be passed to logTarDensFunc, MHPropNewFunc and logMHPropDensFunc.

Value

  • This function returns a list with the following components:
  • temperLadderthe temperature ladder used for the underlying MCMC run.
  • DStatsthe D-statistic (Goswami and Liu, 2007) values used to find the maximum temperature.
  • cutoffDStatsthe cutoffDStats argument.
  • nItersthe post burn-in nIters.
  • levelsSaveSampForthe levelsSaveSampFor argument.
  • drawsarray of dimension nIters $\times$ sampDim $\times$ levelsSaveSampForLen, if saveFitness = FALSE. If saveFitness = TRUE, then the returned array is of dimension nIters $\times$ (sampDim + 1) $\times$ levelsSaveSampForLen; i.e., each of the levelsSaveSampForLen matrices contain the fitness values in their last column.
  • startingValsthe startingVals argument.
  • intermediate statisticsa bunch of intermediate statistics used in the computation of DStats, namely, MCEsts, MCVarEsts, MCESS, ISEsts, ISVarEsts, ISESS, each being computed for all the statistics provided by statsFuncList argument.
  • timethe time taken by the run.

Details

This function is based on the method to find the temperature range introduced in section 4.1 of Goswami and Liu (2007).

[object Object],coord1 <- function (xx) { xx[1] }

coord3 <- function (xx) { xx[3] } statsFuncList <- list(coord1, coord3),[object Object],[object Object],[object Object],rl{ scheme schemeParam ======== ============= linear NA log NA geometric NA mult-power NA add-power $\ge$ 0 reciprocal NA exponential $\ge$ 0 tangent $\ge$ 0 }

We recommended using scheme = 'exponential' and schemeParam in [0.3, 0.5].,[object Object],[object Object],[object Object],[object Object],[object Object]

References

Gopi Goswami and Jun S. Liu (2007). On learning strategies for evolutionary Monte Carlo. Statistics and Computing 17:1:23-38.

See Also

placeTempers, parallelTempering, evolMonteCarlo

Examples

Run this code
coord1        <- function (xx) { xx[1] }
ss            <- function (xx) { sum(xx) }
pp            <- function (xx) { prod(xx) }
statsFuncList <- list(coord1, ss, pp)
maxTemperObj  <-
    with(VShapedFuncGenerator(-13579),
         findMaxTemper(nIters            = 15000,
                       statsFuncList     = statsFuncList,
                       temperLadder      = c(20, 15, 10, 5, 1),
                       startingVals      = c(0, 0),
                       logTarDensFunc    = logTarDensFunc,
                       MHPropNewFunc     = MHPropNewFunc,
                       levelsSaveSampFor = seq_len(5),
                       doFullAnal        = TRUE,
                       verboseLevel      = 1))
print(maxTemperObj)
print(names(maxTemperObj))
with(maxTemperObj,
 {
     par(mfcol = c(3, 3))
     for (ii in seq_along(levelsSaveSampFor)) {
         main <- paste('temper:', round(temperLadder[levelsSaveSampFor[ii]], 3))
         plot(draws[ , , ii],
              xlim = c(-10, 25),
              ylim = c(-10, 10),
              pch  = '.',
              ask  = FALSE,
              main = as.expression(main),
              xlab = as.expression(substitute(x[xii], list(xii = 1))),
              ylab = as.expression(substitute(x[xii], list(xii = 2))))   
     }
 })

Run the code above in your browser using DataLab