count_trips {LDATS} | R Documentation |
Count trips of the ptMCMC particles
Description
Count the full trips (from one extreme temperature chain to
the other and back again; Katzgraber et al. 2006) for each of the
ptMCMC particles, as identified by their id on initialization.
This function was designed to work within TS
and process
the output of est_changepoints
as a component of
diagnose_ptMCMC
, but has been generalized
and would work with any output from a ptMCMC as long as ids
is formatted properly.
Usage
count_trips(ids)
Arguments
ids |
|
Value
list
of [1] vector
of within particle trip counts
($trip_counts
), and [2] vector
of within-particle average
trip rates ($trip_rates
).
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
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())
count_trips(rho_dist$ids)