Multinomial | R Documentation |
Density and random generation for the multinomial distribution
dmulti(x, size = sum(x), prob, log = FALSE)
rmulti(n = 1, size, prob)
x |
vector of values. |
size |
number of trials. |
prob |
vector of probabilities, internally normalized to sum to one, of same length as |
log |
logical; if TRUE, probability density is returned on the log scale. |
n |
number of observations (only |
See Gelman et al., Appendix A or the BUGS manual for mathematical details.
dmulti
gives the density and rmulti
generates random deviates.
Christopher Paciorek
Gelman, A., Carlin, J.B., Stern, H.S., and Rubin, D.B. (2004) Bayesian Data Analysis, 2nd ed. Chapman and Hall/CRC.
Distributions for other standard distributions
size <- 30
probs <- c(1/4, 1/10, 1 - 1/4 - 1/10)
x <- rmulti(1, size, probs)
dmulti(x, size, probs)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.