Is a ts of length one a ts? (PR#245)

Martyn Plummer plummer@iarc.fr
Wed, 11 Aug 1999 19:08:40 +0200 (CEST)


On 11-Aug-99 Prof Brian Ripley wrote:
>> Date: Wed, 11 Aug 1999 13:52:51 +0200 (CEST)
>> From: Martyn Plummer <plummer@iarc.fr>
>> To: Prof Brian D Ripley <ripley@stats.ox.ac.uk>
>> Subject: RE: Is a ts of length one a ts? (PR#245)
>> Cc: r-devel@stat.math.ethz.ch, R-bugs@biostat.ku.dk
>> 
>> On 11-Aug-99 Prof Brian D Ripley wrote:
>> > On Wed, 11 Aug 1999, Martyn Plummer wrote:
>> > 
>> >> On 10-Aug-99 ripley@stats.ox.ac.uk wrote:
>> >> > Is there any good reason why a time series of length one is not
>> >> > allowed by [.ts (you can certainly create one with ts)?
>> >> 
>> >> It certainly has a start and an end value, but what's the
>> >> frequency?  If you want the tsp attribute of a time series
>> >> to be well defined, then maybe you should disallow series
>> >> of length 1.
>> > 
>> > I think the frequency is perfectly well defined, as that of the series you
>> > subsetted.
>> 
>> Is it?
>> 
>> R 0.64.2:
>> 
>> R> x <- ts(1:10)
>> R> frequency(x)
>> [1] 1
>> R> y <- x[c(2,4,6,8,10)]
>> R> frequency(y)
>> [1] 0.5
>> 
> 
> I was only discussing the case of a subset of one, but you omitted
> the next sentence. What I actually said was
> 
> `I think the frequency is perfectly well defined, as that of the series you
> subsetted.  How can extracting one observation change the frequency of
> observation?'
> 
> Obviously, subsetting a regularly spaced series can change the frequency.

Yes, I am sorry for clipping too much of your e-mail in my reply.
I didn't develop my argument properly and it looks facetious.
Let me try again.

x <- ts(1:10)
y <- x[c(1,3,5,7,9)]
 
x1 <- x[1]
y1 <- y[1]

The question we disagree on, I think, is "Are x1 and y1 the same?".
I would say yes.  I don't think that the attributes of a subset should
depend on the sequence of commands used to derive it, and I can't think of
another example in R or S where this is the case.  Although R 0.64.2 and
S-PLUS behave differently here, they both conform to this notion.

Underlying my argument is the notion that two time series with a single
observation and the same start value are identical.  The fact that ts()
can construct two such time series with different frequencies blows a
large hole in my argument so I'll stop.

Martyn
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._