如何创建所需的(大)协方差/相关矩阵?

发布于 2024-10-12 07:23:07 字数 354 浏览 11 评论 0原文

我正在做一个项目,其中包括制作时间序列,其中多个序列的时间演化的随机部分之一具有特定的协方差。问题是,我的很多项目要求我在不同时间序列之间的协方差看起来如何时至少有一定程度的控制,并且我没有找到(以相对速度)找到协方差矩阵的方法一旦大小超过~30,就不再发生。

总结一下:
我想制作 n~50 的对称矩阵,在某些地方有所需的数字,在其他地方为零,并且是正半定的(幸运的是,MATLABs cholcov 仅要求半定性)。

我真诚地希望有人至少有一个想法!

//Niffe

PS:到目前为止,我一直在 MATLAB 中工作,但我对其他语言持开放态度,也对数学之外的解决方案持开放态度。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

忱杏 2024-10-19 07:23:07

现在我终于可以回答我想了。

你想要什么完全取决于你想要什么样的分布。

例如,您可以考虑高斯/正态分布。如果您有协方差矩阵,则可以从 MATLAB 站点。

根据指定均值向量和协方差矩阵的二元正态分布生成值。

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

但是,当然,您可以对此进行任何类型的处理。正如我在您的评论中看到的,您想要生成随机数据。就是这个。从协方差矩阵生成更多协方差矩阵对我来说没有意义。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文