COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

How to build a exponentially weighted moving average covariance matrix?

• Follow

```Hi

I'm desperatly need help with my school project and I hope you guys can help me with this problem. I am new to Matlab and my coding skills are really bad.

I would need a code that would solve this EWMA equation. I also need to solve this many times so I have to put it in a loop so take this in to consideration (if it's needed).

H0=lambda*X*X'+(1-lambda)*H-1

Explaining the equation:
H0=EWMA covariance matrix at time t
lambda=smoothing parameter
X=observation matrix at time t-1
X'=observation matrix transposed at time t-1
H-1=the EWMA covariance matrix for t-1, for the first estimation of H0 this could be regular or moving average covariance matrix after that it should be the last H0 that has been estimated.

I hope you will have time to help me out!
-Henri
```
 0

```help filter
```
 0

```"Matt J " <mattjacREMOVE@THISieee.spam> wrote in message <ho5bh7\$786\$1@fred.mathworks.com>...
> help filter

Thanks , but I need a bit more help than that....(FYI I have 2 weeks of experience with matlab)
```
 0

```When you say "solve" do you mean solve for X (the usual meaning of "solve"), or do you just mean "write code to find H0 given X and Hminus1"?

Guessing that you mean the latter, you've almost got the answer yourself. The equation you give isn't far off Matlab code - the problem with it is that H-1 isn't a variable name, but it seems you want it to be. So taking your equation

> H0=lambda*X*X'+(1-lambda)*H-1

you could code it as

H_new = lambda*X*X' + (1-lambda)*H_old

(changing the names to ones that make more sense to me).

That will go in a loop, and at the end of the loop you can assign H_new to H_old ready for the next iteration. Of course, you'll have to write the code to give values to H_old and lambda before the loop starts, and to give a value to X within the loop, and also code to output the results somehow.

Two weeks isn't long, admittedly, but it should be enough to learn the basic techniques that you need for this. If you are struggling, I think you need to ask your instructor for help.
```
 0

```"Henri Rik" <kingis_fi@hotmail.com> wrote in message <ho7dro\$j0b\$1@fred.mathworks.com>...
> "Matt J " <mattjacREMOVE@THISieee.spam> wrote in message <ho5bh7\$786\$1@fred.mathworks.com>...
> > help filter
>
>
> Thanks , but I need a bit more help than that....(FYI I have 2 weeks of experience with matlab)
====================

That's enough time to have learned to use the 'help' command. If not, you should try it.

In any case, it looks like your problem is just a first order difference equation in H(t). You should be able to solve it by hand. Not sure what you need MATLAB for.

If it helps at all, there is a MATLAB command called residue() that will do the partial fraction expansion for you,

>> help resiude

but I believe in a simple problem like this you could derive an analytical form for the PFE in terms of lambda.
```
 0

4 Replies
939 Views

Similiar Articles:

7/23/2012 7:14:00 PM