# This example demonstrates how to use the function with temporary files,
# Create dummy chain files in a temporary directory
temp_dir <- tempdir()
chain_files <- character(3)
par_names <- c("log_N", "log_k0", "log_cooling_rate", "log_c_repulsion")
sample_data <- data.frame(
log_N = rnorm(100), log_k0 = rnorm(100),
log_cooling_rate = rnorm(100), log_c_repulsion = rnorm(100),
NLL = runif(100), Holdout_MAE = runif(100)
)
for (i in 1:3) {
chain_files[i] <- file.path(temp_dir, paste0("chain", i, ".csv"))
write.csv(sample_data, chain_files[i], row.names = FALSE)
}
# Calculate diagnostics
diag_results <- calculate_diagnostics(chain_files, mutual_size = 50)
print(diag_results)
# Clean up the temporary files and directory
unlink(chain_files)
unlink(temp_dir, recursive = TRUE)
Run the code above in your browser using DataLab