[RsR] Fwd: smart updates and rolling windows

Bradford Cross br@d|ord@n@cro@@ @end|ng |rom gm@||@com
Sun Sep 30 06:52:55 CEST 2007


On 9/29/07, Gabor Grothendieck <ggrothendieck using gmail.com> wrote:
>
> On 9/29/07, Bradford Cross <bradford.n.cross using 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. :-)

	[[alternative HTML version deleted]]




More information about the R-SIG-Robust mailing list