Categorical | R Documentation |
Density and random generation for the categorical distribution
dcat(x, prob, log = FALSE)
rcat(n = 1, prob)
x |
non-negative integer-value numeric value. |
prob |
vector of probabilities, internally normalized to sum to one. |
log |
logical; if TRUE, probability density is returned on the log scale. |
n |
number of observations. |
See the BUGS manual for mathematical details.
dcat
gives the density and rcat
generates random deviates.
Christopher Paciorek
Distributions for other standard distributions
probs <- c(1/4, 1/10, 1 - 1/4 - 1/10)
x <- rcat(n = 30, probs)
dcat(x, probs)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.