Re: aggregate.ts (PR#376)

About this list Date view Thread view Subject view Author view Other groups

Subject: Re: aggregate.ts (PR#376)
ripley@stats.ox.ac.uk
Date: Thu 16 Dec 1999 - 23:48:31 EST


Message-Id: <199912161348.OAA19681@pubhealth.ku.dk>

> From: plummer@iarc.fr
> Date: Thu, 16 Dec 1999 14:15:51 +0100 (MET)
> To: r-devel@stat.math.ethz.ch
> Subject: aggregate.ts (PR#376)
> CC: R-bugs@biostat.ku.dk
> X-Loop: R-bugs@biostat.ku.dk
>
> I'm having some problems with aggregate.ts, e.g.
>
> R> x <- ts(1:20)
> R> frequency(x)
> [1] 1
>
> R> aggregate(x, nfreq=1/3)
> Error in aggregate.ts(x, nfreq = 1/3) : cannot change frequency from 1 to
> 0.333333333333333
>
> In fact aggregate.ts only accepts a new frequency that is a negative
> power of two in this example.
>
> The problem with the current test for compatible frequencies
>
> if ((ofrequency%%nfrequency) != 0)
> stop(paste("cannot change frequency from", ofrequency,
> "to", nfrequency))
>
> is that numerical errors may cause it to fail. I suggest
>
> if (abs(ofrequency%%nfrequency) < ts.eps)

It's been like that since January, and is OK on my machine. This is yet
another example in which the Linux run-time libraries are not
taking account that extended precision calculations are probably
inappropriate:
Browse[1]> ofrequency%%nfrequency
[1] 5.551115e-17
is half or one quarter the machine precision (depending on how you define it).
(We fixed 10 or so such examples a few releases ago where Linux was
differing from Solaris and also from Windows.)

I'll put in the test you suggest (with > not < !) Should we be fixing
%%, that is if y%%x is less than 5*machine precision times abs(x),
returning zero? (I see S-PLUS does not.)

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b25 : Tue 04 Jan 2000 - 14:16:11 EST