Niffe
Niffe

Reputation: 1

How do I create a desired (large) Covariance/Correlation matrix?

I am doing a project which among other things consist of making time series where one of the stochastic parts of the time evolution of multiple series has a specific covariance. The problem is that a lot of my project demands that I have at least a certain amount of control when it comes to how the covariance between the different time series look, and I have figured out no way of (with relative speed) finding covariance matrices at all as soon as the size surpasses ~30.

So to sum up:
I want to make symmetric matrices with n~50 that have desired numbers in certain places, zero in others and are positive semi-definite (MATLABs cholcov only demands semidefiniteness, fortunately).

I Sincerely hope that someone out there has at least an idea!

//Niffe

PS: I've worked in MATLAB so far, but am open to other languages, and also to solutions in nothing but math.

Upvotes: 0

Views: 3909

Answers (1)

Marnix
Marnix

Reputation: 6547

Now I can finally answer I think.

What you want is fully dependent on what kind of distribution you want to have.

For example, you could think of a Gaussian/Normal distribution. If you have your covariance matrix, you could do this, coming from the MATLAB site.

Generate values from a bivariate normal distribution with specified mean vector and covariance matrix.

mu = [1 2];
Sigma = [1 .5; .5 2]; R = chol(Sigma);
z = repmat(mu,100,1) + randn(100,2)*R;

But of course, you could do any kind of process with this. As I can see in your comments, you want to generate random data. That is this. Generating more covariance matrices out of a covariance matrix makes no sense to me.

Upvotes: 4

Related Questions