Learn R Programming

oeli (version 0.5.2)

check_probability_vector: 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))

Value

Compare to check_numeric.

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.