powered by
Density and random generation for the categorical distribution
dcat(x, prob, log = FALSE)rcat(n = 1, prob)
rcat(n = 1, prob)
non-negative integer-value numeric value.
vector of probabilities, internally normalized to sum to one.
logical; if TRUE, probability density is returned on the log scale.
number of observations.
dcat gives the density and rcat generates random deviates.
dcat
rcat
See the BUGS manual for mathematical details.
Distributions for other standard distributions
# NOT RUN { probs <- c(1/4, 1/10, 1 - 1/4 - 1/10) x <- rcat(n = 30, probs) dcat(x, probs) # }
Run the code above in your browser using DataLab