Hi it's me again;)
I would like to loop the RANDNORMAL function using a random correlation matrix for a certain number of times. The results for each drawing should be added horizontally to the already existing ones.
RANDNORMAL is used in combination with a random correlation matrix to create a 1000x100 matrix M of standard normal distributed variables with a specific correlation structure. The goal is to repeat the procedure 20 times. The results of each run should be merged together. The result would be a 1000x20000 matrix. Each 1000x100 block should have a specific correlation structure (determined by the correlation matrix which changes in every run).
I hope you get the idea. I was wondering if you might know a way to loop the RANDNORMAL procedure in combination with a random correlation matrix....
THANKS A MILLION!!!
What have you tried so far?
The hard part here is generating the random correlation matrix. Not every random matrix is a correlation matrix, and the algorithms for generating a correlation matrix are sometimes complicated. How hard it is depends on the "specific correlation structure" that you mention. Some simple structures that are sometimes used in simulations are the "intraclass" correlation structure, the MA(1) correlation structure, and the AR(1) correlation structure.
It looks like you are trying to sample from a multivariate normal distribution in 10 dimensions (since you have 10x10=100 columns).
Do you know how to write a function that generates a random 10x10 correlation matrix with the specific structure?
Depending on what you're trying to do, it might take days or weeks write this function.
Once again I have to thank you for your quick response;)
To be honest, I have't spent much time on thinking about the generation of a random correlation matrix yet. However, since my last post I've figured out how to use macros to loop the entire process. So the random correlation matrix is next on my list.
Which of the structures you've mentioned would you prefer? So far I just thought about using uniformly distributed random numbers on the interval (-1,1), which I would use to create the correlation matrix.
I'm thankful for every comment...
I know it's a little bit off topic but maybe you could help me..I spent some more time thinking about the correlation matrix. Do you know a way in IML to extract a correlation matrix from another (larger) correlation matrix? In detail, I want to select certain variables from a pool of variables. While the correlation matrix of the entire pool has been already calculated the correlation matrix of the selected variables should be extracted from the pool correlation matrix.
The pool consists of 10 variables. The corresponding 10x10 correlation matrix has been already calculated.
Now I select three variables of the pool. How can I extract the 3x3 correlation matrix from the pool correlation matrix via IML?
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.
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.