check_probability_vector {oeli}R Documentation

Check if an argument is a probability vector

Description

This function checks whether the input is a real vector with non-negative entries that add up to one.

Usage

check_probability_vector(x, len = NULL, tolerance = sqrt(.Machine$double.eps))

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

test_probability_vector(x, len = NULL, tolerance = sqrt(.Machine$double.eps))

Arguments

x

Object to check.

len

[integer(1)]
Exact expected length of x.

tolerance

A non-negative numeric 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

Compare to check_numeric.


[Package oeli version 0.4.1 Index]