Message-ID: <971536df0709292200y76232879i8e368b628aeeb9aa@mail.gmail.com>
Date: 2007-09-30T05:00:18Z
From: Gabor Grothendieck
Subject: [RsR] Fwd: smart updates and rolling windows
In-Reply-To: <ea7d6a710709292152k352f6198m9aaee74b2b9bd82a@mail.gmail.com>
Yes, Jarek Tuszynski, the author of caTools, posted a performance comparison
of different methods for rolling calculations using R code and zoo used
that to provide the fastest method in his list for each case. By using C
as in caTools you can get it even faster.
On 9/30/07, Bradford Cross <bradford.n.cross at gmail.com> wrote:
>
>
> On 9/29/07, Gabor Grothendieck <ggrothendieck at gmail.com> wrote:
> > On 9/29/07, Bradford Cross <bradford.n.cross at gmail.com> wrote:
> >
> > > I found a couple simple summary statistics implemented like this in the
> zoo
> > > package. I have also found implementations for smart updates in some
> other
> > > languages (apache commons math, and BOOST accumulators) but these only
> > > supports accumulated calculations, not rolling calculations.
> >
> > I am not sure whether your last sentence was intended to apply to zoo
> > but zoo has several functions for rolling calculations: rollapply,
> rollmax,
> > rollmean, rollmedian . The rollaply is quite general since you
> > supply the function. The caTools package has some high performance
> > functions: runmean, runmin, runmax, runquantile.
> >
>
> Thanks for pointing out caTools. Rollapply is great for the general case -
> but it uses brute force calculation. That is why there are the special
> rollmean, rollmedian because the underlying calculation algorithms still
> need to be optimized to get any performance gain. I suppose a good pattern
> is to use rollapply to test things out, and if particular statistics prove
> especially useful, then optimize the calculation algorithm and add it to a
> specialized library. :-)
>