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

Hello,

Could anyone explain me how to generate two bivariates and correlated normal distributions with 5000  sample size?

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

Can you say more? The title of your post says "univariate and correlated," but your message says "two bivariates," so I am confused. Are you trying to generate X from a multivariate normal and then generate a binary response based on the X variables? Such as simulated data from a logistic model?

You can use the RANDNORMAL function to generate correlated normal data. For example:

proc iml;

call randseed(1);

N = 5000;                 /* sample size */

Mean = {1 2};           /* mean of population */

Cov = {2.4 3, 3 8.1};/* covariance of population */

x = RandNormal( N, Mean, Cov );

View solution in original post

2 REPLIES 2
Rick_SAS
SAS Super FREQ

Can you say more? The title of your post says "univariate and correlated," but your message says "two bivariates," so I am confused. Are you trying to generate X from a multivariate normal and then generate a binary response based on the X variables? Such as simulated data from a logistic model?

You can use the RANDNORMAL function to generate correlated normal data. For example:

proc iml;

call randseed(1);

N = 5000;                 /* sample size */

Mean = {1 2};           /* mean of population */

Cov = {2.4 3, 3 8.1};/* covariance of population */

x = RandNormal( N, Mean, Cov );

Rick_SAS
SAS Super FREQ

I am sorry, but I do not understand.  The RMSE of WHAT goes down?  As you know, you can generate binary variables as 0/1 or as 1/0.  What do you observe if you let p --> 1-p?  In your program, that would correspond to

z[i,j] = (p<=u);

SAS INNOVATE 2024

Innovate_SAS_Blue.png

Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.

If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website. 

Register now!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

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