The Categorical Distribution
Density and random generation functions for the categorical distribution.
vector of integers between 1 and some integer K, inclusive.
vector of probabilities such that
number of observations.
The categorical distribution is a special case of the multinomial distribution with size 1. Values may be between 1 and some integer K, inclusive. If the random variable X is categorical with probability vector p of length K, then P(X=x) = p_x. The density is
f(x) = prod_k p_k^I(x=k) = p_x
where I(.) is the indicator function and k = 1,…,K.
dcategorical gives the density and
rcategorical generates random deviates.
Multinom in package
Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.