Perhaps this answer will help to implement it:
One class of matrices with this non-negative definiteness property is Wishart Distribution . And the samples from ~ W () that all off-diagonal entries are between some boundaries [l, u] will fit your question. However, I do not believe that this is the same as the distribution of all positive definite matrices with off-diagonals in [1, u].
The wikipedia page has a calculation algorithm from ~ W ().
A simpler, hacky solution (perhaps approximating this):
(given that u> l and l> 0)
- extracted from the multidimensional normal, where Sigma = mean (l, u).
- Then, taking the sample, calculating its correlation matrix => C
- This matrix will have some fuzz, but the math about how much it will have is a bit out of my league for me to calculate. The off-diags values ββin this matrix C are bounded [-1,1], with an average value (l, u). On the eyeball, I guess some kind of beta / exponent. In any case, that the continuous distribution of off diags in C ensures that it will not behave and lies within the boundaries of (l, u), unless (l, u) = [-1,1].
- You can adjust the amount of βfluffβ by increasing / decreasing the sample length in step 1. I would set (not prove) that the variance in C odd-diags is proportional to the square root of the number of samples.
So, it seems nontrivial to really answer!
As the other posters suggested, you can generate from Wishart, and then save the ones you want, it's true, but you can select the selection for a long time! If you exclude those that are 0-defined (is that a word?), Then this should work just fine to create good matrices. However, this is not the true distribution of all pos-def matrices whose off-diags are in [l, u].
Code (in R) for the proposed silent sampling scheme
sigma1 <- function(n,sigma) { out <- matrix(sigma,n,n) diag(out) <- 1 return (out) } library(mvtnorm) sample_around_sigma <- function(size, upper,lower, tight=500) {
source share