Derivative of an exponentially weighted moving average

1.4k Views Asked by At

It has been a while since my university math courses, so let me apologize right off the bat...

I'm using GSL to perform non-linear regression analysis and am mostly happy with the outcome, however, my covariance matrix is not looking right and I suspect that I have not calculated the derivative of my equation properly.

The equation in question is as follows:

$$ y(t) = k_1*g(t) - k_2*h(t) $$ $$ g(t) = g(t-1)*e^{-1/tau_1}+l_t $$ $$ h(t) = h(t-1)*e^{-1/tau_2}+l_t $$

The best I've come up with in terms of the derivatives are as follows: $$ \frac{\partial y}{\partial k_1} =g(t) = g(t-1)*e^{-1/tau_1}+l_t $$ $$ \frac{\partial y}{\partial k_2} = -h(t) = -h(t-1)*e^{-1/tau_2}+l_t $$ $$ \frac{\partial y}{\partial tau_1} = \frac{k_1*g(t-1)*e^{-1/tau_1}}{tau_1^2} $$ $$ \frac{\partial y}{\partial tau_2} = -\frac{k_2*h(t-1)*e^{-1/tau_2}}{tau_2^2} $$

However, I suspect these derivatives are incorrect and would appreciate any guidance.

1

There are 1 best solutions below

1
On

Your problem is that $g(t) = e^{-\tau_1} g(t-1) + l_t$ is a delay equation, the solution of which is $$ g(t) = e^{-\frac{t}{\tau_1}} \left( \lfloor t \rfloor f(t - \lfloor t \rfloor) + \sum_{m=0}^{\lfloor t \rfloor} l_{m+t-\lfloor t \rfloor } e^{\frac{\lfloor t \rfloor}{\tau_1}} \right) $$ with f(t) an arbitrary function on $[0,1)$,
and similarly for $h(t)$. Although you could differentiate this expression with respect to $\tau_1$ (and your expression does not get that answer), this extra function degree of freedom will cause you grief unless you apply some conditions (such as analyticity and/or some initial conditions) that fix $f(t)$.