
MULTINOMIAL RANDOM NUMBERName:
The multinomial distribution extends this by allowing k possible outcomes. These outcomes are mutually exclusive with each outcome having probability p_{i}. The p_{i} must sum to 1 and are the same for each trial. The multinomial distribution is the probability that each event occurs x_{i} times (i = 1, 2, ..., k) in the n trials. For univariate distributions, Dataplot generates random numbers using the common syntax
LET Y = <dist> RANDOM NUMBERS FOR I = 1 1 N LET Y = LOC + SCALE*Y Multivariate distributions, however, generally require matrix operations. For this reason, random numbers for multivariate distributions each have their own unique syntax. To generate multinomial random numbers, you need to specify a variable containing the k probabilities for each outcome (these probabilities must sum to 1), a scalar value specifying the number of trials (n), and a scalar value specifying the number of multinomial events (nevents) to simulate. The output is a matrix with nevent rows and k columns. Each row of the matrix should sum to n.
where <p> is a variable containing the desired probabilities for each outcome; <n> is a number or parameter specifying the desired number of trials; <nevents> is a number or parameter specifying the number of multinomial events being generated; and where <mat> is a matrix where the resulting multinomial random numbers are stored. Dataplot determines the number of possible outcomes from the number of rows in the <p> variable. The returned matrix will have <nevents> rows and columns equal to the number of rows in <p>.
LET N = 100 LET NEVENTS = 10 LET M = MULTINOMIAL RANDOM NUMBERS P N
"NonUniform Random Variate Generation", Luc Devroye, SpringerVerlang, 1986, p. 559.
dimension 100 columns . let p = data 0.2 0.1 0.2 0.3 0.2 let n = 200 let nevents = 10 . let m = multinomial random numbers p n nevents . set write decimals 0 print mDataplot generated the following output. MATRIX M  10 ROWS  5 COLUMNS VARIABLESM1 M2 M3 M4 M5 33 14 46 67 40 48 22 38 59 33 46 19 38 60 37 37 20 35 61 47 37 28 33 61 41 40 17 35 69 39 33 16 37 68 46 35 24 39 66 36 39 17 39 62 43 33 18 51 54 44
Date created: 5/21/2003 