How to generate random covariance matrix

I want to generate a covariance matrix in R. However, after trying different methods, no one has been successful for obtaining a matrix with the properties I want. rWishart could be a good method, where I can choose the number of degrees of freedom and a scale matrix.

This is a small example of what I am trying:

nvars = 100

K = rWishart(n=1, df=nvars, Sigma=diag(nvars))[,,1] 

However, I am not sure how can I have an easy to handle way, based on 1 or 2 parameters, to manage the values of the covariances (higher or lower), as I haven't used this distribution before.

Does anyone know how could I do this?

Thanks in advance for any help!

Not sure whether you already seen this or not, but it has nice discussion on this and multiple answers.

2 Likes

Thanks for your reply! Very interesting solutions right there

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.