Matlab:与滞后相关运算有关的混乱 [英] Matlab: Confusion related to Correlation operation for lags

查看:282
本文介绍了Matlab:与滞后相关运算有关的混乱的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个时间序列模型y(t)= h^T y(t-1) + n(t),其中n(t)是激发并驱动过程的高斯白噪声. yt = 1,2,...的线性回归模型的输出,表示数据点的数量.

I have a time series model y(t)= h^T y(t-1) + n(t) where n(t) is a white Gaussian noise that excites and drives the process. y is the output of a linear regression model for t = 1,2,... denoting the number of data points.

问题:如果Correlation矩阵为Ryy = E[y(t)*y(t)^T],,则可以计算滞后随机变量(例如

Question: If the Correlation matrix is Ryy = E[y(t)*y(t)^T], then is it possible to compute Correlation of the lagged random variables such as

 [E[y(t-1)*y(t-1)']]

通常,这些运算符和表达式也位于:

In general, these operators and expressions are also found in:

幻灯片2 提到了自相关矩阵.在公式中,有Expectation运算符.那么,如何在不使用内置命令的情况下,实现滞后随机变量与其自身以及其他此类表达式的乘积的期望呢?

Slide2 mentions the Autocorrelation matrix. In the formula, there is the Expectation operator. So how do I implement the expectation of the product of the lagged random variable with itself and other such expressions without using the inbuilt commands?

我无法实现这种公式.请帮忙.

I am unable to implement these kind of formulae. Please help.

谢谢您的解释!

更新:对此问题进行了多次修订后,它又归结为另一个问题, Matlab:计算时间序列的相关性.因此,这两个问题已经重复.

UPDATE: After doing multiple revisions to this Question, it has boiled down to another Question asked Matlab: Calculating Correlation of time series . So, these two Questions have become duplicate.

这是示例代码

y = randn(10,1);

for t = 1:10
disp(y(t));
end

Expectation_y =  sum(y(1:end))/10 % this give a scalar

Mean_y = mean(y); % This returns 10 values 

推荐答案

您可能会混淆随机向量(多变量随机变量)的相关矩阵和随机过程(随机过程)的自相关矩阵...

You might be confusing the Correlation matrix of a random vector (multivariate random variable), and the autocorrelation matrix of a random process (stochastic process)...

因此,如果您的意向是阶数为1的向量自回归模型(似乎是,因此h'是您的系数矩阵),则E[y(t-1)*y(t-1)']确实有意义,并且是随机向量本身的相关矩阵

So if your serie is a vector autoregressive model of order 1 (which it seems to be, so h' is your coefficient matrix), then indeed E[y(t-1)*y(t-1)'] makes sense, and is the Correlation matrix of the random vector itself.

现在假设处于平稳状态,您可以通过检查det(I - h'*x) = 0的根x_i在单位圆之外(具有大于1的模数)来进行检查,然后y[t_1]的统计属性等于对于所有t_1, t_2来说,y[t_2]的那些都足够大.因此,实际上:

Now under the assumption of stationarity, which you can check by checking that the roots x_i of det(I - h'*x) = 0 are outside the unit circle (have modulus greater than 1), then the statistical properties of y[t_1] are equivalent to those of y[t_2] for all t_1, t_2 that are large enough. So in effect:

E[y(t-1)*y(t-1)'] = E[y(t)*y(t)']

如果您的过程不稳定,那么您就麻烦了,因为现在您的相关矩阵取决于t_0 ...

If your process is NOT stationary, you're in trouble, since now your correlation matrix depends on the boundary conditions of t_0...

但是,您可能要寻找的表达式是:

What you might be looking for, however, are expressions like:

E[y(t)*y(t-1)'] = E[(h'*y(t-1) + n(t))*y(t-1)']

但是我不知道在E[y(t)*y(t)']的功能中是否存在这些的解析表示形式...您可以在网上进行研究,也可以在幻灯片提供的参考文献中进行研究...

But I don't know if there are analytical representations of these in function of E[y(t)*y(t)']... You can research that online, or in the references that your slides provide...

由于OP提到这是一个简单的自回归模型,而不是矢量自回归模型,因此事情得到了极大的简化.

Since the OP has mentioned that this is a simple autoregressive model and not a vector autoregressive model, things are greatly simplified.

对于平稳的AR(1)模型,均值,方差和自协方差(以及自相关)都有很好的解析表示形式,在这里我将为更通用的模型提供它们:y(t) = c + h*y(t-1) + n(t)

For stationary AR(1) models, there are nice analytical representations of the mean, variance and autocovariance (and thus autocorrelation), I'll give them here for the more general model: y(t) = c + h*y(t-1) + n(t)

E[y(t)] = c/(1-h) --> so in your case: 0
Var[y(t)] = Var[n(t)]/(1-h^2) --> this is equal to the E[y(t)y(t)] or E[y(t-1)y(t-1)] that you are looking for
Cov[y(t)y(t-j)] = Var[n(t)]*h^j/(1-h^2)
Corr[y(t)y(t-j)] = h^j --> this is the autocorrelation in function of the timedifference j

您可以在参考书中或法语维基百科页面上找到有关这些数学解释的所有很好的解释:此处,在过程中的AR(1)时刻"

You can find all the mathematical derivations for these nicely explained in a reference book, or on the french wikipedia page: here, in the section "Moments d'un processus AR(1)"

现在真的可以归结为您要寻找的东西了... E[y(t-1)y(t-1)]根据平稳性的定义完全等于E[y(t)y(t)],也许您真的在寻找E[y(t)y(t-1)]的派生词,我将在这里进行开发:

It really boils down now to what you are looking for... E[y(t-1)y(t-1)] is simply equal to E[y(t)y(t)] by definition of stationarity, maybe you were really looking for the derivation of E[y(t)y(t-1)], which I will develop here:

 E[y(t)y(t-1)] = E[(h*y(t-1) + n(t))*y(t-1)] = E[(h*y(t-1))*y(t-1)] + E[n(t)*y(t-1)]

现在,由于n(t)是t中的白噪声,因此它与y(t-1)不相关,所以E[n(t)*y(t-1)] = 0,所以我们有:

Now since n(t) is the white noise in t, it is uncorrelated with y(t-1), so E[n(t)*y(t-1)] = 0, so we have:

E[y(t)y(t-1)] = E[(h*y(t-1))*y(t-1)] = h*E[(y(t-1))*y(t-1)] = h*Var[y(t)] = h*Var[N(t)]/(1-h^2)

与上面给出的Cov[y(t)y(t-j)]的定义完全匹配...

Which matches exactly the definition of Cov[y(t)y(t-j)]given above...

希望这会有所帮助.

这篇关于Matlab:与滞后相关运算有关的混乱的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆