Skip to content
Prev 201025 / 398503 Next

How to setup the tsp attribute of a dataset

Looks like there is a difference between when I use frequency(x) vs. 
when I use frequency(x.ts). If I try to get the tsp attribute of x by 
using attr(x, "tsp"), it still shows up as NULL. When I looked at the 
code of frequency() function (in stats), it seems to be looking at 
attr(x, "tsp"), which is NULL, so the function returns 1.
Let me relate the context a bit. I am trying to use the function 
forecast:nsdiffs to perform a Canova-Hansen test for a given dataset. 
Even though I specify the seasonality, in an internal function, 
frequency(x) is used to find seasonality, and since that value is 1 (as 
I explained above: it looks at attr(x, "tsp")), the calculations do not 
succeed.
On 11/20/2009 4:25 PM, Gabor Grothendieck wrote: