Skip to contents

Pure function mapping a validated spec_ir into an explicit UI descriptor containing only the sections and input controls relevant to that exact specification. For example, a single-level Gaussian complete-data spec emits no cluster count, ICC, random-slope, missingness-rate, or REML controls.

Usage

spec_to_controls(spec)

Arguments

spec

A validated spec_ir object.

Value

An S3 object of class spec_ui_descriptor containing:

  • sections: named list of section descriptors, each holding a list of control descriptors.

  • control_ids: character vector of all synthesized control IDs.

  • control_count: integer number of active controls.

  • math_summary: output of spec_to_math().

  • structure_key: deterministic structural signature for diffing UI topology.

  • available_grid_axes: character vector of valid sweepable grid axes for this design.

Examples

s1 <- new_spec_ir(design_type = "monte_carlo_lm", hierarchy = list(levels = 1L, n_obs = 150L))
d1 <- spec_to_controls(s1)
d1$control_ids
#>  [1] "n_obs"             "outcome_family"    "residual_sd"      
#>  [4] "error_dist"        "pred_beta_x1"      "pred_sd_x1"       
#>  [7] "pred_centering_x1" "effects_intercept" "missing_mechanism"
#> [10] "n_reps"            "alpha"             "seed"             

s2 <- new_spec_ir(
  design_type = "multilevel_sim",
  hierarchy = list(levels = 2L, n_clusters = 50L, cluster_size = 20L, icc = 0.2)
)
d2 <- spec_to_controls(s2)
d2$control_ids
#>  [1] "n_clusters"        "cluster_size"      "cluster_size_dist"
#>  [4] "icc"               "outcome_family"    "residual_sd"      
#>  [7] "error_dist"        "pred_beta_x1"      "pred_sd_x1"       
#> [10] "pred_centering_x1" "effects_intercept" "missing_mechanism"
#> [13] "n_reps"            "alpha"             "seed"             
#> [16] "estimator_reml"