[R] Exponentially Weighted Moving Average

davidr at rhotrading.com davidr at rhotrading.com
Tue Jul 3 15:42:14 CEST 2007


You could use rollFun from fMultivar package.
You need to define your EWMA function separately.
(Usually the EWMA moves along with a constant window size, though ....)

David L. Reiner
Rho Trading Securities, LLC
550 W. Jackson Blvd #1000
Chicago, IL 60661-5704
 
312-244-4610 direct
312-244-4500 main
312-244-4501 fax
 

-----Original Message-----
From: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of livia
Sent: Tuesday, July 03, 2007 5:51 AM
To: r-help at stat.math.ethz.ch
Subject: [R] Exponentially Weighted Moving Average


Hi, I have got a series of data "x" and some parameter "a", and I would
like
to take some Exponentially Weighted Moving Average to the data in the
following fomula, and obtain the return series y

y1=a^265*x[2]+a^264*x[3]+a^263*x[4]+...+a^0*x[267]

y2=a^264*x[4]+a^263*x[5]+a^263*x[6]+...+a^0*x[268]

....

y265=a^1*x[530]+a^0*x[531]

y266=a^0*x[532]

Could anyone give me some advice how can I achieve this?
Many thanks

-- 
View this message in context:
http://www.nabble.com/Exponentially-Weighted-Moving-Average-tf4017572.ht
ml#a11409874
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list