GenData: Synthetic Data From a Multinomial Distribution

Description Usage Arguments References Examples

Description

This function generates a synthetic data set representing multiple draws from a multinomial distribution with user-specified parameters. A matrix of n rows corresponding to each draw is outputted where the entry in the ith column and the jth row gives the number of the items that were in the ith bin on the jth trial.

Usage

1
GenData(center, n, size)

Arguments

center

Vector of numeric values defining the parameters of a multinomial distribution. The ith value corresponds to the likelihood of a random variable being drawn from the ith bin

n

The n argument for the rmultinom function in base R which is defined to be the "number of random vectors to draw"

size

The Size argument for the rmultinom function in base R which is defined to be an "integer, say N, specifying the total number of objects that are put into K boxes in the typical multinomial experiment."

References

R Core Team (2015). R: A language and environment for statistical computing. R Foundation for Statistical Computing, Vienna, Austria. https://www.R-project.org/.

rmultinom: https://stat.ethz.ch/R-manual/R-patched/library/stats/html/Multinom.html

Examples

1
2
#Generate sample data from a multinomial distribution
GenData(center = c(0.2, 0.3, 0.5), n = 10, size = 20)

Example output

Loading required package: lattice
      [,1] [,2] [,3]
 [1,]    3    5   12
 [2,]    4    7    9
 [3,]    5    6    9
 [4,]    6    4   10
 [5,]    2    6   12
 [6,]    8    6    6
 [7,]    7    7    6
 [8,]    3    4   13
 [9,]    7    5    8
[10,]    3    9    8

SALTSampler documentation built on May 2, 2019, 11:27 a.m.