Generates multinomial pseudo-random numbers (D.B. Baird).
||Number of values to generate|
||Seed to generate the random numbers; default 0 continues an existing sequence or initializes the sequence automatically if no random numbers have been generated in this job|
||Probabilities for the categories|
||Saves the random numbers|
||Saves counts of the numbers generated in each category|
GRMNOMIAL generates pseudo-random numbers from a multinomial distribution. The probabilities for the categories are specified by the
PROBABILITIES option, in either a variate or a table.
The numbers can be saved, in a factor, using the
NUMBERS parameter. The
NVALUES option specifies the number of values to be generated. If this is not set, the length of the
NUMBERS factor is used or, if that has not been defined, a single value is generated.
COUNTS parameter can save a table with counts of the numbers generated in each category. If
COUNTS has not already been defined as a table with a suitable classifying factor, it is defined as follows. Firstly, if
NUMBERS has been set,
COUNTS is defined as a table with
NUMBERS as the classifying factor. Otherwise, if
PROBABILITIES has supplied a table rather than a variate,
COUNTS is defined as a table classified by the same classifying factor as
PROBABILITIES. Finally, the fall-back is to define
COUNTS as a table with an unnamed classifying factor.
SEED option can be set to initialize the random-number generator. The default of zero continues an existing sequence, or initializes the sequence automatically if no random numbers have been generated in this job.
The pseudo-random numbers are generated using the
Action with RESTRICT
Any restrictions are ignored.
Commands for: Calculations and manipulation.
CAPTION 'GRMNOMIAL example',\ !t('Generate 200 values from a multinomial distribution',\ 'with probabilities 0.4, 0.3, 0.2 and 0.1.'); STYLE=meta,plain VARIATE [VALUES=0.4,0.3,0.2,0.1] Probabilities FACTOR [LABELS=!t(%40,%30,%20,%10)] Numbers GRMNOMIAL [NVALUES=200; SEED=259452] Probabilities; NUMBERS=Numbers;\ COUNTS=Counts PRINT Counts