Statistical programming, matrix languages, and more

Simulation from Correlated Multivariate Uniform Distribution

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 13
Accepted Solution

Simulation from Correlated Multivariate Uniform Distribution

Dr. Wicklin's text provides significant support for simulating data from correlated multivariate distributions.  However, his text does not provide code for Simulating data from Correlated Multivariate Uniform Distributions.  Can anyone provide some example code?

For example, could I simply change the RANNOR to RANUNI in the below code?

data MVN (type = CORR); _TYPE_='CORR';

  set bhf.R;

run;

proc factor N=19 OUTSTAT=FACOUT;

run;

DATA PATTERN;

  SET FACOUT;

  IF _TYPE_='PATTERN';

  DROP _TYPE_ _NAME_;

RUN;

PROC IML;

  USE PATTERN;

  READ ALL VAR _NUM_ INTO F;

  F=F`;

  PRINT f;

DATA = RANNOR(J(10000,19,0));

DATA = DATA`;

  Z = F*DATA;

  Z = Z`;

  X1=Z[,1]*0.418378 + 0.01284361;

  X2=Z[,2]*0.418378 + 0.06569127;

  X3=Z[,3]*0.418378 + 0.02904674;

  X4=Z[,4]*0.418378 + 0.01284361;

  X5=Z[,5]*0.418378 + 0.02904674;

  X6=Z[,6]*0.418378 + 0.09878997;

  X7=Z[,7]*0.418378 + 0.02904674;

  X8=Z[,8]*0.418378 + 0.043682;

  X9=Z[,9]*0.418378 + 0.06569127;

  X10=Z[,10]*0.418378 + 0.043682;

  X11=Z[,11]*0.418378 + 0.01931489;

  X12=Z[,12]*0.418378 + 0.02904674;

  X13=Z[,13]*0.418378 + 0.02904674;

  X14=Z[,14]*0.418378 + 0.0437;

  X15=Z[,15]*0.418378 + 0.0657;

  X16=Z[,16]*0.418378 + 0.02904674;

  X17=Z[,17]*0.418378 + 0.043682;

  X18=Z[,18]*0.418378 + 0.01931489;

  X19=Z[,19]*0.418378 + 0.02904674;

  Z=X1||X2||X3||X4||X5||X6||X7||X8||X9||X10||X11||X12

  ||X13||X14||X15||X16||X17||X18||X19;

  CREATE A FROM Z [COLNAME={X1 X2 X3 X4 X5 X6 X7 X8 X9

  X10 X11 X12 X13 X14 X15 X16 X17 X18 X19}];

  APPEND FROM Z;

PROC MEANS DATA=A N MEAN STD SKEWNESS KURTOSIS;

  VAR X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15

  X16 X17 X18 X19;

PROC CORR DATA=A NOSIMPLE;

  VAR X1 X2 X3 X4 X5 X6 X7 X8 X9 X10 X11 X12 X13 X14 X15

  X16 X17 X18 X19;

RUN;

Thanks!


Accepted Solutions
Solution
‎01-29-2015 12:05 PM
SAS Super FREQ
Posts: 3,234

Re: Simulation from Correlated Multivariate Uniform Distribution

A correlated MV uniform distribution is called a copula. See p. 164-173.

View solution in original post


All Replies
Solution
‎01-29-2015 12:05 PM
SAS Super FREQ
Posts: 3,234

Re: Simulation from Correlated Multivariate Uniform Distribution

A correlated MV uniform distribution is called a copula. See p. 164-173.

Occasional Contributor
Posts: 13

Re: Simulation from Correlated Multivariate Uniform Distribution

Dr. Wicklin - I think this approach may work.....you might recognize most of it!

I generated univariate uniform random variates with specified means.  Then I used the approach you described in your text, namely, the Iman-Conover method to generate multivariate data with the specified marginals I just mentioned and a desired correlation structure.  (I assumed the Pearson correlation was close enough to the Spearman rank correlation.)

I think it may be good enough.....

In the mean time, what is the difference between using the Iman-Conover method and any of the copula approaches? It seems like they are accomplishing the same task....

Thanks again for your support as I learn a new subject.


Brian

SAS Super FREQ
Posts: 3,234

Re: Simulation from Correlated Multivariate Uniform Distribution

Yes. The Iman-Conover method uses ideas that are similar to copulas, which is why I placed it just before the section on copulas. I also begin the section on copulas with the sentences "Each of the previous sections describes.... That is exactly what a mathematical copula does."

You will discover that special cases of the copula have been (re)discovered many times in the literature.

SAS Super FREQ
Posts: 3,234

Re: Simulation from Correlated Multivariate Uniform Distribution

BTW, there is an errata for the program on p. 162.  About 6 lines from the bottom of the program, the statement in the book are

y = X[,i];

call sort(y);

X[,i] = y[rank];

The correct statements are

tmp = X[,i];

call sort(tmp);

X[,i] = tmp[rank];

Occasional Contributor
Posts: 13

Re: Simulation from Correlated Multivariate Uniform Distribution

Thanks Dr. Wicklin. I accessed the code from your author's page, so it appears that code was corrected there.  Thanks for the heads up.

Post a Question
Discussion Stats
  • 5 replies
  • 411 views
  • 1 like
  • 2 in conversation