This function checks the provided settings list for missing values and assigns default values where necessary. It ensures that all required settings for the Parallel Tempering Monte Carlo (PTMC) simulation are specified and provides appropriate defaults if any are missing. The function also validates specific parameters by checking the model for any necessary attributes.

check_settings_discete(settings, model)

Arguments

settings

A list of settings for the PTMC simulation. The function checks and fills missing settings with default values. The following settings can be provided:

  • numberChainRuns: The number of chains to run in parallel.

  • numberCores: The number of CPU cores to use for parallel processing (default is equal to numberChainRuns).

  • numberTempChains: The number of temperature chains for the Parallel Tempering (default is 10).

  • iterations: The number of iterations for each chain (default is 20,000).

  • burninPosterior: The burn-in period for posterior samples (default is 10,000).

  • thin: The thinning interval for samples (default is 100).

  • consoleUpdates: The frequency of console updates (default is 100).

  • numberFittedPar: The number of parameters to fit in the model. If not specified, it is set to the length of model$namesOfParameters.

  • onAdaptiveCov: Whether to use adaptive covariance updates (default is TRUE).

  • updatesAdaptiveCov: The frequency of updates for the adaptive covariance (default is 100).

  • burninAdaptiveCov: The burn-in period for adaptive covariance updates (default is 2,000).

  • onAdaptiveTemp: Whether to use adaptive temperature updates (default is TRUE).

  • updatesAdaptiveTemp: The frequency of updates for adaptive temperature (default is 10).

  • onDebug: Whether to enable debugging output (default is FALSE).

  • lowerParBounds: The lower bounds for the parameters. If not specified, it is set to model$lowerParSupport_fitted.

  • upperParBounds: The upper bounds for the parameters. If not specified, it is set to model$upperParSupport_fitted.

  • covarInitVal: The initial covariance value (default is 1e-10).

  • covarInitValAdapt: The initial adaptive covariance value (default is 1e-10).

  • covarMaxVal: The maximum allowed covariance value (default is 1).

  • runParallel: Whether to run the simulation in parallel (default is TRUE).

  • lengthDiscreteVec: The length of the discrete vector, which should be specified as model$discrete_length.

  • updateDiscreteFreq: The frequency at which to update the discrete vector (default is 0).

model

A list representing the model used in the PTMC simulation. The function checks if specific model-related attributes are available to fill in missing settings (e.g., lowerParSupport_fitted, upperParSupport_fitted, and discrete_length).

Value

A list of validated and updated settings. If any setting was missing or invalid, the corresponding default value is filled in, and a message is printed to the console.

Examples

# Example usage of check_settings_discete function
model <- list(
  namesOfParameters = c("param1", "param2"),
  lowerParSupport_fitted = c(-5, -5),
  upperParSupport_fitted = c(5, 5),
  discrete_length = 10
)
settings <- list(
  numberChainRuns = 4,
  numberCores = 4,
  numberTempChains = 10,
  iterations = 20000,
  burninPosterior = 10000,
  thin = 100
)
validated_settings <- check_settings_discete(settings, model)
#> `consoleUpdates` not specified in settings. Default value 100. 
#> `numberFittedPar` not specified in settings. Default value equal to the number of parameters in the model  2 . 
#> `onAdaptiveCov` not specified in settings. Default value TRUE. 
#> `updatesAdaptiveCov` not specified in settings. Default value 100. 
#> `burninAdaptiveCov` not specified in settings. Default value 2000. 
#> `onAdaptiveTemp` not specified in settings.  Default value TRUE. 
#> `updatesAdaptiveTemp` not specified in settings.  Default value 10. 
#> `lowerParBounds` not specified in settings. Defaults to lowerParSupport_fitted. 
#> `upperParBounds` not specified in settings. Defaults to upperParSupport_fitted 
#> `covarInitVal` not specified in settings.  Default value 1e-10. 
#> `covarInitValAdapt` not specified in settings.  Default value 1e-10. 
#> `covarMaxVal` not specified in settings. Default value 1. 
#> `runParallel` not specified in settings. Default value TRUE. 
#> `lengthDiscreteVec` not specified in settings. Defaults to  10 . 
#> `updateDiscreteFreq` not specified in settings. Default value 0.