Summarize the step and swap acceptance rates as well as trip metrics from the saved output of a ptMCMC estimation.

diagnose_ptMCMC(ptMCMCout)

Arguments

ptMCMCout

Named list of saved data objects from a ptMCMC estimation including elements named step_accepts (matrix of logical outcomes of each step; rows: chains, columns: iterations), swap_accepts (matrix of logical outcomes of each swap; rows: chain pairs, columns: iterations), and ids (matrix of particle identifiers; rows: chains, columns: iterations). ptMCMCout = NULL indicates no use of ptMCMC and so the function returns NULL.

Value

list of [1] within-chain average step acceptance rates ($step_acceptance_rate), [2] average between-chain swap acceptance rates ($swap_acceptance_rate), [3] within particle trip counts ($trip_counts), and [4] within-particle average trip rates ($trip_rates).

Details

Within-chain step acceptance rates are averaged for each of the chains from the raw step acceptance histories (ptMCMCout$step_accepts) and between-chain swap acceptance rates are similarly averaged for each of the neighboring pairs of chains from the raw swap acceptance histories (ptMCMCout$swap_accepts). Trips are defined as movement from one extreme chain to the other and back again (Katzgraber et al. 2006). Trips are counted and turned to per-iteration rates using count_trips.

This function was first designed to work within TS and process the output of est_changepoints, but has been generalized and would work with any output from a ptMCMC as long as ptMCMCout is formatted properly.

References

Katzgraber, H. G., S. Trebst, D. A. Huse. And M. Troyer. 2006. Feedback-optimized parallel tempering Monte Carlo. Journal of Statistical Mechanics: Theory and Experiment 3:P03018 link.

Examples

# \donttest{
  data(rodents)
  document_term_table <- rodents$document_term_table
  document_covariate_table <- rodents$document_covariate_table
  LDA_models <- LDA_set(document_term_table, topics = 2)[[1]]
  data <- document_covariate_table
  data$gamma <- LDA_models@gamma
  weights <- document_weights(document_term_table)
  data <- data[order(data[,"newmoon"]), ]
  rho_dist <- est_changepoints(data, gamma ~ 1, 1, "newmoon",
                               weights, TS_control())
  diagnose_ptMCMC(rho_dist)
# }