Learn R Programming

prob (version 1.0-1)

is.probspace: Testing for a Probability Space

Description

Decides whether a given object is a probability space.

Usage

is.probspace(x)

Arguments

x

an object for which probability space status should be checked.

Value

Logical.

Details

It first checks if the class of the object includes ps, and if so TRUE is returned. If not, then it checks that the object is a data frame and contains a probs column. Lastly, it checks whether all entries of probs are nonnegative. Note that it does not check whether the sum of probs is one, to allow for the possibility that the input object is a proper subset of a probability space.

See Also

probspace

Examples

Run this code
# NOT RUN {
S <- rolldie(3, makespace = TRUE)
is.probspace(S)
# }

Run the code above in your browser using DataLab