probs: Generate a Random Vector of Probabilities.

Description Usage Arguments Value Examples

View source: R/probs.R

Description

Generate a random vector of probabilities that sum to 1.

Usage

1
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

1
2
3
probs(10)
sum(probs(100))
pie(table(month(10000, prob = probs(12))))

wakefield documentation built on May 30, 2017, 3:40 a.m.