Hi everyone,


I am looking for a way of simulating correlation matrices of fixed dimension in (at least) two ways. 


First, I would like to determine the "uniform" distribution over the "correlation matrices space" and being able to sample from it (even defining what "uniform" means is not such an easy task !!!).


Second, I would like to get some parametric law for which sampled correlation matrices would be such that :


-the expectations of the eigenvalues are equal to some fixed set of values.


-we have a certain amount of "control" over the second moments of those eigenvalues through the parameters set.


I hope I made myself clear enough, and thank's for any leads or references to acheive such a thing. From my point of view this is a surprisingly complex problem and I thought it might raise some interest among you. 


So far I tried an approach using diagonalization through orthogonal matrices and eigenvalues which was not really a success...


Edit :


Here are a few facts (sometimes empirical) that have come up when trying a diagonalization approach by an orthogonal matrix and a set of eigenvalues.(i.e. $C=\Omega Diag(\lambda\_1,...,\lambda\_n)\Omega^T$ with (I hope) obvious notations). 


Naively, you can think that it would suffice to sample uniformly and independently a set of eigenvalue in the n-simplex and uniformly sample from orthogonal matrices space, after what you "do" the mutliplication to get a correlation matrix that is uniformly sampled in the correlation matrices sapce. But...


If your are given a set of eigenvalues (for your correlation matrix), then you can't sample (uniformly) an orthogonal matrix and get a correlation matrix after multiplication. 


There are $n(n-3)/2$ degrees of freedom among the parameters of the orthogonal matrix to get a correlation matrix, when the space O(n) is a $n(n-1)/2$ dimensional space (the diagonal of the correlation matrix are constrained to be equal to 1 and that makes n equations). The "submanifolds" of O(n) that is so defined (to be compatible orthogonal matrices with respect to a set of eigenvalues) is really hard to express in a way that could be usefull.


Also, a fact that has (empirically) appeared is that sampling uniformly from orthognonal matrix space, then I thnik taht almost surely the eigenvalues that are compatible to get a correlation matrix are simply (1,...,1). So the correlation matrix is simply the identity matrix $I\_n$ and this is I think the real surpising fact to me (not too surprisng though if you consider the degrees of freedom in the problem)


Regards



Uniform correlation matrix sampling and not so uniform laws 
Even if this answer doesn't give a satisfying answer to the second point of my original question, [I found an article that answers exactly to the first point](https://arxiv.org/abs/1809.00351) untitled "A fast Metropolis-Hastings method for generating random correlation matrices" from Irene Córdoba, Gherardo Varando, Concha Bielza, Pedro Larrañaga, moreover the authors have developped their algorithm in a R Package. 
So I wanted to share this with anybody who might be in need of such sampler. As a matter of fact there are several other possible answers and the article gives references to those (also with R packages for some of them). The benefit of the article is that it allows sampling in high dimension with computational efficiency.


