Skip to contents

Performs pure-R structural schema validation (category = "schema") and statistical sanity and identifiability checks (category = "statistical"), including strict ASCII identifier allowlists, closed nested object keys (rejecting unknown extra fields from LLM JSON), positive variances and sample sizes, ICC bounds, random-slope identifiability, positive-definite predictor and random-effects correlation matrices via eigenvalue checks, missingness bounds, estimator-family compatibility, and parameter grid bounds.

Usage

validate_spec_ir(spec, strict = FALSE)

Arguments

spec

A spec_ir object (or list) to validate.

strict

Logical; if TRUE, aborts with a formatted cli error when validation fails. Defaults to FALSE, returning a spec_validation report.

Value

An S3 object of class spec_validation with elements:

  • valid: logical scalar (TRUE when nrow(errors) == 0L).

  • errors: data.frame with columns path, code, category, message.

  • warnings: data.frame with columns path, code, category, message.

Examples

spec <- new_spec_ir()
validate_spec_ir(spec)
#> ✔ spec_ir validation passed (0 errors, 0 warnings).