Learn R Programming

PoissonMultinomial (version 1.1)

rpmd: Poisson-Multinomial Distribution Random Number Generator

Description

Generates random samples from the PMD specified by the success probability matrix.

Usage

rpmd(pmat, s = 1)

Value

An \(s \times m\) matrix of samples, each row stands for one sample from the PMD with success probability matrix pmat.

Arguments

pmat

An \(\rm n \times m\) success probability matrix, where \(\rm n\) is the number of independent trials and \(\rm m\) is the number of categories. Each row of pmat contains the success probabilities for the corresponding trial, and each row adds up to 1.

s

The number of samples to be generated.

Examples

Run this code
pp <- matrix(c(.1, .1, .1, .7, .1, .3, .3, .3, .5, .2, .1, .2), nrow = 3, byrow = TRUE)
 
rpmd(pmat = pp, s = 5)

Run the code above in your browser using DataLab