Class MultinomialRVG
- java.lang.Object
-
- dev.nm.stat.random.rng.multivariate.MultinomialRVG
-
- All Implemented Interfaces:
RandomVectorGenerator
,Seedable
public class MultinomialRVG extends Object implements RandomVectorGenerator
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 isrmultinom
in packagenormix
.
-
-
Constructor Summary
Constructors Constructor Description MultinomialRVG(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double[]
nextVector()
Gets the next random vector.void
seed(long... seeds)
Seed the random number/vector/scenario generator to produce repeatable experiments.
-
-
-
Constructor Detail
-
MultinomialRVG
public MultinomialRVG(int N, double[] prob, RandomLongGenerator uniform)
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 Detail
-
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
-
-