BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
bonfa
Calcite | Level 5

Dear's

I simulated a dataset bivariate wich normal distribution.

PROC IML;

N=100000;

MEAN={0.074, 0.1274};

COV={0.000302 0.000581, 0.000581 0.00156};

CALL RANDSEED(12345);

P=RANDNORMAL(N,MEAN,COV);

CREATE ESTRUTURA_1 FROM P; APPEND FROM P; CLOSE ESTRUTURA_1;

RUN;

However I would like to simulate the dataset with chi square distribution, how do I proceed?

Best regards.

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

Do you want n=100,000 observations drawn randomly from a chi-square distribution with D degrees of freedom? By using IML? Then use

proc iml;

DF = 10;

N = 100000;

x = j(N,1);                       /* allocate vector */

call randseed(12345);    /* set random number seed */

call randgen(x, "Chisquare", DF); /* fill vector */

View solution in original post

5 REPLIES 5
Ksharp
Super User

Maybe you should check :

x = RAND(’CHISQUARE’,df)

Xia Keshan

bonfa
Calcite | Level 5

Dear Keshan,

I tried to use the

X=RAND(ÇHISQUARE',df)

But I don't know simulate a dataset with n=100000 using this command.

I tried to use the DO command, but it still fails.

Best regards.

Rick_SAS
SAS Super FREQ

Do you want n=100,000 observations drawn randomly from a chi-square distribution with D degrees of freedom? By using IML? Then use

proc iml;

DF = 10;

N = 100000;

x = j(N,1);                       /* allocate vector */

call randseed(12345);    /* set random number seed */

call randgen(x, "Chisquare", DF); /* fill vector */

bonfa
Calcite | Level 5

Dear Rick,

Thank's

JacobSimonsen
Barite | Level 11

Or, you can do it inside a datastep.

data simualation;

  df=1;

  call streaminit(1234567); /*initialize the seed is optional*/;

  do i=1 to 100000;

  chisq=rand('chisq',df);

  output;

  end;

run;

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 5 replies
  • 1735 views
  • 0 likes
  • 4 in conversation