This function runs multiple Markov Chains in parallel or sequentially to generate output from a Parallel Tempering Monte Carlo (PTMC) model. The output includes the posterior parameter samples, discrete state information, log posterior values, temperatures, and acceptance rates.

get_discrete_output(model, data_list, settings, update_ind, par)

Arguments

model

A list representing the model containing information such as parameter names and any model-specific settings required for running the PTMC.

data_list

A list containing the data necessary for running the model. This could include observed data, priors, and any other variables needed for the simulation.

settings

A list containing the settings for the model execution. The list must contain: - numberChainRuns: The number of chains to run in parallel. - runParallel: A boolean indicating whether to run the chains in parallel (TRUE) or sequentially (FALSE). - numberFittedPar: The number of parameters to fit in the model.

update_ind

An index or flag used to control which part of the model or data to update during the PTMC simulation.

par

A list of parameters or starting values for the chains. Each element corresponds to one chain.

Value

A list containing the results of the PTMC simulation. The list includes:

mcmc

An MCMC object containing the posterior samples of the model parameters.

discrete

A list of discrete states generated during the simulation for each chain.

lpost

A data frame of log-posterior values, with columns representing different chains and rows representing samples.

temp

A data frame of temperatures for each chain at each sample.

acc

A data frame of acceptance rates for each chain at each sample.

outPTpar

A list containing the parameter values for each chain.