BookmarkSubscribeRSS Feed
Calcite | Level 5

## simulation two different samples from multivariate dichotomous variables

hi

i need your help to simulate two different sample from multivariate dichotomous variables by using sas/iml and the program below for 1 sample how can i circulate for two samples.

thanks in advance

%include "C:\Users\hp\Desktop\RandMVBinary.sas";

proc iml;

load module=_all_;                     /* load the modules */

p = {0.25  0.75  0.5  0.25  0.30  0.10  0.30  0.55  0.25 0.65};       /* expected values of the X   */

Delta = {1     0.15  0.2   0.175  0.15  0.125 0.1   0.075 0.05  0.025,

0.15  1     0.225 0.15   0.175 0.075 0.125 0.1   0.075 0.05 ,

0.2   0.225 1     0.225  0.2   0.15  0.15  0.125 0.1   0.075,

0.175 0.15  0.225 1      0.225 0.2   0.175 0.15  0.125 0.1  ,

0.15  0.175 0.2   0.225  1     0.225 0.2   0.175 0.15  0.125,

0.125 0.075 0.15   0.2   0.225 1     0.225 0.125 0.175 0.1  ,

0.1   0.125 0.15   0.175 0.2   0.225 1     0.225 0.2   0.175,

0.075 0.1   0.125 0.15   0.175 0.125 0.225 1     0.225 0.2  ,

0.05  0.075 0.1   0.125  0.15  0.175 0.2   0.225 1     0.2  ,

0.025 0.05  0.075 0.1    0.125 0.1   0.175 0.2   0.2   1    };

X = RandMVBinary(1000, p, Delta);

/* compare sample estimates to parameters */

print p, Delta;

create MVbinary from X;  append from X;  close MVB;

quit;

8 REPLIES 8
SAS Super FREQ

## Re: simulation two different samples from multivariate dichotomous variables

Y = RandMVBinary(1000, p, Delta);

Calcite | Level 5

## Re: simulation two different samples from multivariate dichotomous variables

thanks alot dr. rick

please where can i put this y = RandMVBinary(1000, p, Delta); because i have x = RandMVBinary(1000, p, Delta);     in my program , and after putting this command y = RandMVBinary(1000, p, Delta); the program will be

%include "C:\Users\hp\Desktop\RandMVBinary.sas";

proc iml;

load module=_all_;                     /* load the modules */

p = {0.25  0.75  0.5  0.25  0.30  0.10  0.30  0.55  0.25 0.65};       /* expected values of the X   */

Delta = {1     0.15  0.2   0.175  0.15  0.125 0.1   0.075 0.05  0.025,

0.15  1     0.225 0.15   0.175 0.075 0.125 0.1   0.075 0.05 ,

0.2   0.225 1     0.225  0.2   0.15  0.15  0.125 0.1   0.075,

0.175 0.15  0.225 1      0.225 0.2   0.175 0.15  0.125 0.1  ,

0.15  0.175 0.2   0.225  1     0.225 0.2   0.175 0.15  0.125,

0.125 0.075 0.15   0.2   0.225 1     0.225 0.125 0.175 0.1  ,

0.1   0.125 0.15   0.175 0.2   0.225 1     0.225 0.2   0.175,

0.075 0.1   0.125 0.15   0.175 0.125 0.225 1     0.225 0.2  ,

0.05  0.075 0.1   0.125  0.15  0.175 0.2   0.225 1     0.2  ,

0.025 0.05  0.075 0.1    0.125 0.1   0.175 0.2   0.2   1    };

X = RandMVBinary(1000, p, Delta);

y = RandMVBinary(1000, p, Delta);

/* compare sample estimates to parameters */

print p, Delta;

create MVbinary from X;  append from X;  close MVB;

quit;

i get on just one sample i want 2 samples, you mean i must repeat the program one to x and another to y?

thanks in advance

THANOON

Calcite | Level 5

## Re: simulation two different samples from multivariate dichotomous variables

i think i must repeat the program one time for x and another time for y too get on different samples.

thanks alot dr. rick

SAS Super FREQ

## Re: simulation two different samples from multivariate dichotomous variables

You don't need two programs. Assign Y after you have assigned X within the same program.

Calcite | Level 5

## Re: simulation two different samples from multivariate dichotomous variables

thank you so much i want to apply same method on mvordinal with two samples but i got on same results for X AND Y.how can i solve this problem.

many thanks

Calcite | Level 5

## Re: simulation two different samples from multivariate dichotomous variables

thanks alot dr.rick i solve it . i want to ask you when i applied same equation X and Y in mvordinal i got on same results why?

many thanks

SAS Super FREQ

## Re: simulation two different samples from multivariate dichotomous variables

You should not get the same answer if you compute both in a single PROC IML program.

If you run the same program twice, you will get the same answer because the random number seed is the same.

Calcite | Level 5

## Re: simulation two different samples from multivariate dichotomous variables

So I must change the random number seed for the second program.

Thanks alot

From The DO Loop
Want more? Visit our blog for more articles like these.
Discussion stats
• 8 replies
• 1624 views
• 0 likes
• 2 in conversation