Class MultinomialRVG
java.lang.Object
dev.nm.stat.random.rng.multivariate.MultinomialRVG
- All Implemented Interfaces:
RandomVectorGenerator
,Seedable
A multinomial distribution puts N objects into K bins according
to the bins' probabilities. An output random vector counts the number of
objects in each bin, making a total of N.
The R equivalent function is
rmultinom
in package normix
.-
Constructor Summary
ConstructorsConstructorDescriptionMultinomialRVG
(int N, double[] prob) Constructs a multinomial random vector generator.MultinomialRVG
(int N, double[] prob, RandomLongGenerator uniform) Constructs a multinomial random vector generator. -
Method Summary
Modifier and TypeMethodDescriptiondouble[]
Gets the next random vector.void
seed
(long... seeds) Seed the random number/vector/scenario generator to produce repeatable experiments.
-
Constructor Details
-
MultinomialRVG
Constructs a multinomial random vector generator.- Parameters:
N
- an integer, say N, specifying the total number of objects that are put into K boxes in a typical multinomial experimentprob
- a numeric non-negative vector of length K, specifying the probability for the K boxesuniform
- a uniform random number generator
-
MultinomialRVG
public MultinomialRVG(int N, double[] prob) Constructs a multinomial random vector generator.- Parameters:
N
- an integer, say N, specifying the total number of objects that are put into K boxes in a typical multinomial experimentprob
- a numeric non-negative vector of length K, specifying the probability for the K boxes
-
-
Method Details
-
seed
public void seed(long... seeds) Description copied from interface:Seedable
Seed the random number/vector/scenario generator to produce repeatable experiments. -
nextVector
public double[] nextVector()Description copied from interface:RandomVectorGenerator
Gets the next random vector.- Specified by:
nextVector
in interfaceRandomVectorGenerator
- Returns:
- the next random vector
-