turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

Topic Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

11-16-2011 07:15 PM

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.

*Example:*

*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!!!

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to MarkGIP

11-17-2011 08:59 AM

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.

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Rick_SAS

11-17-2011 10:27 AM

Hi Rick!

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...

THANK YOU!!!!

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to MarkGIP

11-18-2011 08:44 AM

Hi!

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.

Example:

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?

THANK YOU!!!

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to MarkGIP

11-18-2011 08:51 AM

See pp. 31-32 of my book Statistical Programming with SAS/IML Software.Those pages are available as a FREE download.

To choose three random columns, use the RANCOMB function.

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Rick_SAS

11-20-2011 12:27 PM

Thank you so much, Rick!

I'm really thinking about getting your book

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to MarkGIP

11-21-2011 09:45 AM

It makes the perfect Christmas gift, although it is too big to fit in a stocking. :-)