wakefield (version 0.3.3)

probs: Generate a Random Vector of Probabilities.

Description

Generate a random vector of probabilities that sum to 1.

Usage

probs(j, upper = 1e+06)

Arguments

j

An integer of number of probability elements (typically performs best at j < 4000).

upper

probs works by sampling from 1:upper j times and then dividing each sample by the sum of all samples.

Value

Returns a vector of probabilities summing to 1.

Examples

Run this code
# NOT RUN {
probs(10)
sum(probs(100))
pie(table(month(10000, prob = probs(12))))
# }

Run the code above in your browser using DataLab