Calculate Exponetial Moving Covariance

12 ビュー (過去 30 日間)
Tommaso Delicato
Tommaso Delicato 2021 年 2 月 18 日
回答済み: Jeff Miller 2021 年 2 月 18 日
I should calculate a variance-covariance matrix over a 60-month rolling window, but so that the newer data has more weight than the older data, such as an exponential moving average. Can you give me a hand? thank you in advance

採用された回答

Jeff Miller
Jeff Miller 2021 年 2 月 18 日
Not really a hand, but maybe some hints...Let's say you have variables x and y, and you want the exponentially weighted rolling means, variances, and covariances.
It looks like you can get the means with dsp.MovingAverage (though I haven't done this so am not sure of the details).
To get the variances and covariances, form the new variables x.^2, y.^2, and x.*y. You can also compute the moving averages of these new variables with dsp.MovingAverage.
Finally, at each time point compute the variance as e.g., [rolling average of x.^2 - (rolling average of x)^2] and the covariance as [rolling average of x.*y - (rolling average of x)*(rolling average of y)]

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDescriptive Statistics についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by