rmultinomial: Random Number Generator for the Multinomial Distribution

Description Usage Arguments Details Value Note Author(s) Examples

View source: R/simulation.functions2.R

Description

Generates a random count vector for one observation of a multinomial distribution for n trials with probability vector pr.

Usage

1
rmultinomial(n = 5, pr = c(0.5, 0.5), long = FALSE)

Arguments

n

Number of trials.

pr

Probability vector.

long

TRUE to choose one generator, FALSE to choose another one.

Details

Generates a random count vector for one observation of a multinomial distribution for n trials with probability vector pr.

Value

x

Vector of counts.

Note

This function is only used in the examples and not in the multinomRob code.

Author(s)

Walter R. Mebane, Jr., University of Michigan, wmebane@umich.edu, http://www-personal.umich.edu/~wmebane

Jasjeet S. Sekhon, UC Berkeley, sekhon@berkeley.edu, http://sekhon.berkeley.edu/

Examples

1
 rmultinomial(10, c(.3, .3, .4));

Example output

Loading required package: rgenoud
##  rgenoud (Version 5.7-12.4, Build Date: 2015-07-19)
##  See http://sekhon.berkeley.edu/rgenoud for additional documentation.
##  Please cite software as:
##   Walter Mebane, Jr. and Jasjeet S. Sekhon. 2011.
##   ``Genetic Optimization Using Derivatives: The rgenoud package for R.''
##   Journal of Statistical Software, 42(11): 1-26. 
##

Loading required package: MASS
Loading required package: mvtnorm
## 
##  multinomRob (Version 1.8-6.1, Build Date: 2013/02/15)
##  See http://sekhon.berkeley.edu/robust for additional documentation.
##  Please cite as: Walter R. Mebane, Jr. and Jasjeet S. Sekhon. "Robust Estimation
##   and Outlier Detection for Overdispersed Multinomial Models of Count Data".
##   American Journal of Political Science, 48 (April): 391-410. 2004.
##

[1] 1 5 4

multinomRob documentation built on May 2, 2019, 6:54 a.m.