Description Usage Arguments Value Examples
prep_ids creates and update_ids updates
the active vector of identities (ids) for each of the chains in the
ptMCMC algorithm. These ids are used to track trips of the particles
among chains.
These functions were designed to work within TS and
specifically est_changepoints, but have been generalized
and would work within any general ptMCMC as long as control,
ids, and swaps are formatted properly.
1 2 3 | prep_ids(control = list())
update_ids(ids, swaps)
|
control |
A |
ids |
The existing vector of chain ids. |
swaps |
Chain configuration after among-temperature swaps. |
The vector of chain ids.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | prep_ids()
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"]), ]
saves <- prep_saves(1, TS_control())
inputs <- prep_ptMCMC_inputs(data, gamma ~ 1, 1, "newmoon", weights,
TS_control())
cpts <- prep_cpts(data, gamma ~ 1, 1, "newmoon", weights, TS_control())
ids <- prep_ids(TS_control())
for(i in 1:TS_control()$nit){
steps <- step_chains(i, cpts, inputs)
swaps <- swap_chains(steps, inputs, ids)
saves <- update_saves(i, saves, steps, swaps)
cpts <- update_cpts(cpts, swaps)
ids <- update_ids(ids, swaps)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.