| dCategorical | R Documentation |
Calculate probability masses for integer valued Categorical random samples. For a random variable x, the density function of categorical distribution is defined as
prod_{k in 1:K} p_k^{I(x=k)}
Where K is the number of unique values.
dCategorical(x, p)
x |
integer, categorical samples. |
p |
numeric, probabilities. |
A numeric vector of the same length of 'x'.
rCategorical
dCategorical(x=c(1L,2L,1L),p=c(1,2))