R: The Multinomial Distribution

Multinomial {nimble} | R Documentation

## The Multinomial Distribution

### Description

Density and random generation for the multinomial distribution

### Usage

    dmulti(x, size = sum(x), prob, log = FALSE)

    rmulti(n = 1, size, prob)

### Arguments

`x` | vector of values.
`size` | number of trials.
`prob` | vector of probabilities, internally normalized to sum to one, of same length as `x`
`log` | logical; if TRUE, probability density is returned on the log scale.
`n` | number of observations (only `n=1` is handled currently).

### Details

See Gelman et al., Appendix A or the BUGS manual for mathematical details.

### Value

`dmulti` gives the density and `rmulti` generates random deviates.

### Author(s)

Christopher Paciorek

### References

Gelman, A., Carlin, J.B., Stern, H.S., and Rubin, D.B. (2004) Bayesian Data Analysis, 2nd ed. Chapman and Hall/CRC.

### See Also

Distributions for other standard distributions

### Examples

    size <- 30
    probs <- c(1/4, 1/10, 1 - 1/4 - 1/10)
    x <- rmulti(1, size, probs)
    dmulti(x, size, probs)

[Package nimble version 0.9.1 Index]