Skip to contents

Compares multiple K selection methods (BIC, ICL with various temperatures, Ensemble, Adaptive, Silhouette) across a parameter grid.

Usage

run_k_selection_comparison(
  test = FALSE,
  cores = 4,
  output_dir = NULL,
  parallel_strategy = c("local", "pbs", "future"),
  pbs_config = list(),
  pbs_submit = FALSE,
  pbs_wait = FALSE,
  Kvec = 2:6,
  r_fixed = 2,
  max_iter = 50,
  verbose = TRUE
)

Arguments

test

Logical. If TRUE, use smaller test grid. Default FALSE.

cores

Integer. Number of CPU cores. Default 4.

output_dir

Character. Output directory. Default auto-detected.

parallel_strategy

Character. "local", "pbs", or "future".

pbs_config

List. PBS configuration (queue, walltime, mem, r_module).

pbs_submit

Logical. If TRUE, submit PBS job. Default FALSE (dry run).

pbs_wait

Logical. If TRUE, wait for PBS completion. Default FALSE.

Kvec

Integer vector. Candidate K values. Default 2:6.

r_fixed

Integer. Fixed r value for two-stage. Default 2.

max_iter

Integer. Maximum EM iterations. Default 50.

verbose

Logical. Print progress. Default TRUE.

Value

Data frame with results, or PBS job info if using PBS.

Details

This function compares the following K selection methods:

  • BIC: Bayesian Information Criterion

  • ICL_T1: ICL with temperature = 1.0

  • ICL_T2: ICL with temperature = 2.0 (recommended)

  • ICL_T3: ICL with temperature = 3.0

  • Ensemble: Majority vote of BIC, ICL_T1, ICL_T2

  • Adaptive: Adaptive temperature selection

  • Silhouette: Silhouette-based selection

Examples

if (FALSE) { # \dontrun{
# Local test run
results <- run_k_selection_comparison(test = TRUE, cores = 2)

# Full simulation
results <- run_k_selection_comparison(test = FALSE, cores = 8)

# PBS submission
run_k_selection_comparison(
  test = FALSE,
  parallel_strategy = "pbs",
  pbs_config = list(queue = "batch"),
  pbs_submit = TRUE
)
} # }