prob (version 1.0-1)

probspace: Probability Spaces

Description

Forms a probability space from a set of outcomes and (optional) vector of probabilities.

Usage

probspace(x, …)

# S3 method for default probspace(x, probs, …)

# S3 method for list probspace(x, probs, …)

Arguments

x

a vector, data frame, or list of outcomes.

probs

a vector of non-negative weights of the same length as outcomes

further arguments to be passed to or from other methods.

Value

If outcomes is a vector or data frame, then the value is a data frame with an added probs column. If outcomes is a list, then the value is a list with components outcomes (the supplied list) and a probs component.

Details

The elements of probs will be normalized to ensure that their sum is one. If probs is not specified, then the equally likely model is assumed in which every outcome has the same probability.

See Also

iidspace

Examples

Run this code
# NOT RUN {
R <- rolldie(3)
probspace(R)
# }

Run the code above in your browser using DataCamp Workspace