validate: Check an object thoroughly

View source: R/class_model.R

validateR Documentation

Check an object thoroughly

Description

For a micsim_model(), runs every check and reports everything it finds at once. Errors: a rate that raises an error, returns something other than one number per input, NA or a negative value on a grid of whole ages, calendar years and durations; a newborn table that has no state for a mother. Warnings: a rate that is zero everywhere or exceeds 10 per person-year; a transition nobody can reach; a state nobody can leave. Inf is allowed for forced transitions.

Usage

validate(x, ...)

## S3 method for class 'micsim_model'
validate(x, strict = FALSE, ...)

Arguments

x

An object to check, here micsim_model.

...

Passed to methods.

strict

If TRUE, warnings are treated as errors.

Details

During construction the model already checked that each rate is a function with admissible arguments and that it returns one value per input.

Validation checks the values at the grid points. For example, a rate that passes at whole ages can still fail at a fractional age. Assessing whether the model is suitable for the research question is a separate step.

Because validation returns the model, you can pass it directly to model |> validate() |> simulate(seed = 234)

Value

x, invisibly, if no error is found. Otherwise an error of class micsim_invalid_model listing every problem. Warnings are given as one micsim_model_warning. Both carry ⁠$problems⁠, a data frame with one row per finding.

See Also

micsim_model(), MicSim-concepts


MicSim documentation built on Dec. 2, 2026, 1:09 a.m.