Skip to contents

Selects the best-matching purity and scale factor (dicovsf) from a grid of models, based on user input (value or range), and returns the optimal combination for downstream analysis.

Usage

ParseParm(purity, dicovsf, models)

Arguments

purity

Numeric, character, or NULL. Desired purity value, or a range in the format "min:max" (e.g., "0.5:0.7"). If NULL, all available purity values in models are considered.

dicovsf

Numeric, character, or NULL. Desired scale factor (mu), or a range in the format "min:max" (e.g., "0.9:1.1"). If NULL, all available scale factor values in models are considered.

models

Data frame or tibble. Model grid with columns rho (purity), mu (scale factor), total_distance_to_integer, and total_log_likelihood generated by initial run.

Value

A named list with elements:

final_purity

Selected purity value.

final_sf

Selected scale factor (mu) value.

Details

  • If a range is provided for purity or dicovsf, all models within that range are considered.

  • If a single value is provided, the closest available value in models is selected.

  • The model with the lowest total_distance_to_integer and highest total_log_likelihood is chosen.

Examples

# ParseParm(purity = "0.5:0.7", dicovsf = NULL, models = models_df)
# ParseParm(purity = 0.6, dicovsf = 1.1, models = models_df)