check_transition_probability checks if transition probabilities are in [0, 1] and reports any entry that is not, including entries that are NA or NaN.

check_transition_probability(a_P, err_stop = FALSE, verbose = FALSE)

Arguments

a_P

A transition probability array.

err_stop

Logical variable to stop model run if set up as TRUE. Default = FALSE.

verbose

Logical variable to indicate print out of messages. Default = FALSE

Value

Invisibly, a data frame with one row per entry of a_P that is not a valid probability, empty when the array is valid. With err_stop = TRUE the function stops instead, and with verbose = TRUE it warns, listing the offending entries.

Examples

l_params_all <- load_all_params()
a_P <- decision_model(l_params_all)$a_P
check_transition_probability(a_P, verbose = TRUE)