get_output.Rd
This function performs the core steps of running multiple chains of the Parallel Tempering Monte Carlo (PTMC) simulation and processes the results. It either runs the chains in parallel or sequentially, collects the output from each chain, and organizes it into a list format. The output includes posterior samples, log-posterior values, temperatures, acceptance rates, and other diagnostic information for each chain.
get_output(model, data_list, settings, update_ind, par)
A list representing the model to be used in the PTMC simulation. This typically includes information such as model parameters, parameter names, and other model-specific settings required for the simulation.
A list containing the data used by the model. This could include observed data, prior distributions, or other inputs necessary for the PTMC simulation.
A list of settings for the PTMC simulation. The settings must include:
numberChainRuns
: The number of parallel chains to run.
runParallel
: Logical, whether to run the chains in parallel.
numberFittedPar
: The number of parameters to fit in the model.
numberCores
: The number of CPU cores to use for parallel execution (if runParallel = TRUE
).
Other relevant settings that influence the PTMC process, such as iteration count, burn-in period, etc.
Logical flag indicating whether to update the model parameters. Typically, this is used to specify whether parameters should be updated during the simulation.
A list of parameters for each chain. Each element of the list corresponds to the parameter values for one chain. If provided, these values are used for the chains; otherwise, the simulation will use default parameter values.
A list containing the processed output of the PTMC simulation, which includes:
mcmc
: An mcmc.list
object containing the posterior samples from each chain.
lpost
: A data frame of log-posterior values for each sample and chain.
temp
: A data frame of temperatures for each chain.
acc
: A data frame of acceptance rates for each chain.
outPTpar
: A list of parameter values for each chain during the simulation.
This function is designed to handle both parallel and sequential execution of PTMC chains. If runParallel
is TRUE
,
the chains are executed in parallel using the mclapply
function. Otherwise, the chains are executed sequentially
in a loop. The output is processed and reshaped into appropriate data frames for easy analysis.