Skip to contents

These functions check whether the input is a transition probability matrix.

Usage

check_transition_probability_matrix(
  x,
  dim = NULL,
  tolerance = sqrt(.Machine$double.eps)
)

assert_transition_probability_matrix(
  x,
  dim = NULL,
  tolerance = sqrt(.Machine$double.eps),
  .var.name = checkmate::vname(x),
  add = NULL
)

test_transition_probability_matrix(
  x,
  dim = NULL,
  tolerance = sqrt(.Machine$double.eps)
)

Arguments

x

[any]
Object to check.

dim

[integer(1)]
The matrix dimension.

tolerance

[numeric(1)]
A non-negative tolerance value.

.var.name

[character(1)]
Name of the checked object to print in assertions. Defaults to the heuristic implemented in vname.

add

[AssertCollection]
Collection to store assertion messages. See AssertCollection.

Value

Same as documented in check_matrix.

Examples

T <- matrix(c(0.8,  0.2,  0.1, 0.1,  0.7,  0.4, 0.1,  0.1,  0.6), nrow = 3)
check_transition_probability_matrix(T)
#> [1] "Must have row sums equal to 1"
test_transition_probability_matrix(T)
#> [1] FALSE
if (FALSE) { # \dontrun{
assert_transition_probability_matrix(T)
} # }