Calculate Exponetial Moving Covariance

12 visualizzazioni (ultimi 30 giorni)
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

Risposta accettata

Jeff Miller
Jeff Miller il 18 Feb 2021
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)]

Più risposte (0)

Categorie

Scopri di più su Descriptive Statistics in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by