[R] using filter() to sum up

T.Riedle tr206 at kent.ac.uk
Mon May 4 21:38:00 CEST 2015

Hi everybody,

I am trying to create a code for the formula in the attachment. I first tried following code:

ltau <- m + theta*sum(psi*X[t-k])

but it does not work and I get for X[t-k] every third element in my vector three times which looks as follows:
[1] -0.25 -0.25 -0.25 0.50 0.50 0.50 -0.44 -0.44 -0.44 0.15 0.15 0.15

Thus, I tried the filter() function in R which looks as follows:
ltau <- m + theta* filter(f.USA$UTS, phi(K, omega1, omega2), sides=1, method="conv")

Reading the description of this function I am unsure whether this provides the sum of the k lags. The appreviation "conv" provides, as far as I understand, the moving average instead of the sum.

Does anybody have an idea how the R code for the formula attached must look like? Is the filter() function appropriate?

Thanks in advance.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tau.png
Type: image/png
Size: 8142 bytes
Desc: tau.png
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20150504/7ceb3dd1/attachment.png>

More information about the R-help mailing list