/*************************************************************************************/ /* This script, MVN.JSL, generates multivariate normal data using the Cholesky */ /* root of the variance-covariance matrix. */ /* */ /* Requirements of the user: */ /* Supply your variance-covariance as the "varcov" matrix, */ /* Supply a vector of means as the "means" matrix, */ /* Enter the number of rows desired as the "n". */ /* */ /* To verify the means, run Analyze-->Distribution with all columns. To verify */ /* the variance/covariance structure, run Analyze-->Multivariate Methods--> */ /* Multivariate with all columns. */ /* */ /* This script was developed for JMP 5.1.1, and no error checking is performed. */ /* */ /*************************************************************************************/ // Define the variance/covariance matrix; varcov=[4.0 1.8 4.0 3.6 , 1.8 9.0 3.6 1.0 , 4.0 3.6 16.0 1.5 , 3.6 1.0 1.5 20.0 ]; // Define the vector of means; means=[10,20,30,40]; // Define the number of data rows to produce; n=10000; ones=j(1,n,1); meansmx=means*ones; v=NRow(means); l=Cholesky(varcov); z=j(v,n,RandomNormal()); x=l*z; X2=meansmx + x; xt=Transpose(x2); mvn=AsTable(xt); mvn<