
MULTIVARIATE NORMAL RANDOM NUMBERSName:
LET Y = <dist> RANDOM NUMBERS FOR I = 1 1 N LET Y = LOC + SCALE*Y Multivariate distributions, however, genrally require matrix operations. For this reason, random numbers for multivariate distributions each have their own unique syntax. Although you can generate P columns of normal random numbers, this does take into account any correlation between the variables (i.e., they are independent). To generate an NxP matrix of normal random numbers in Dataplot, you must specify a Px1 mean vector and a PxP variancecovariance matrix. The mean vector specifies the location parameters for each of the P columns. The diagonal of the variancecovariance matrix specifies the scale parameters of the P columns.
<mu> <sigma> <n> where <mu> is a variable containing the desired location parameters; <sigma> is a matrix containing the desired variancecovariance matrix; <n> is a number or parameter specifying the desired number of rows; and where <mat> is a matrix where the resulting multivariate normal random numbers are stored. Dataplot determines the number of columns to generate from the number of rows in the <mu> vector. Note that the number of rows in <mu> must equal the number of rows (and columns) in <sigma> and <sigma> must be a symmetric positivedefinite matrix (i.e., a value variancecovariance matrix).
READ MATRIX SIGMA 1 0.5 0.5 0.5 1 0.5 0.5 0.5 1 END OF DATA LET N = 500 LET M = MULTIVARIATE NORMAL RANDOM NUMBERS MU SIGMA N
"Introduction to Matrix Computations", G. W. Stewart, Academic Press, Algorithm 3.9, p. 142.
dimension 100 columns . read matrix sigma 1.0 0.707107 0.0 0.0 0.0 0.707107 1.0 0.5 0.5 0.5 0.0 0.5 1.0 0.5 0.5 0.0 0.5 0.5 1.0 0.5 0.0 0.5 0.5 0.5 1.0 end of data . let mu = data 0 0 0 0 0 let n = 200 . let m = multivariate normal random numbers mu sigma n . multiplot corner coordinates 0 0 100 100 multiplot 2 3 title automatic loop for k = 1 1 5 relative histogram m^k end of loop
Date created: 5/16/2003 