This function performs the Parallel Tempering Monte Carlo (PTMC) simulation. It first validates the provided settings using the check_settings function, then either uses default or provided parameters to run the simulation via the get_output function. The function returns the output of the simulation, which includes various results depending on the model, data, and settings.

ptmc_func(model, data, settings, par = NULL)

Arguments

model

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.

data

A list containing the data used by the model. This could include observed data, prior distributions, or other inputs necessary for the PTMC simulation.

settings

A list of settings for the PTMC simulation. The settings must include:

  • numberChainRuns: The number of parallel chains to run.

  • Other relevant settings required by the PTMC process, which will be validated using the check_settings function.

par

(Optional) A list of parameters for each chain. If provided, each element of the list corresponds to the parameter values for one chain. If not provided (or empty), default parameters are used for the chains.

Value

A list containing the output of the PTMC simulation. The output is generated by calling the get_output function, and may include components such as:

  • Posterior samples of model parameters

  • Discrete model states

  • Log-posterior values

  • Temperatures for each chain

  • Acceptance rates for each chain

  • Parameter values for each chain