[R] ts vs zoo

Philippe Grosjean phgrosjean at sciviews.org
Thu Oct 12 09:53:07 CEST 2006



Schweitzer, Markus wrote:
>> Hello,
>>
>> I have lots of data in zoo format and would like to do some time
>> series analysis. (using library(zoo), library(ts) )
>>
>> My data is usually from one year, and I try for example  stl() to find
>> some seasonalities or trends.
>>
>> I have now accepted, that I might have to convert my series into ts()
>> but still I am not able to execute the comand since stl() is not
>> satisfied
>>
>> x<-zoo(rnorm(365), as.Date("2005-01-01"):as.Date("2005-12-31"))
>> x<-as.ts(x)
>> #x<-as.ts(x, frequency=12)  #this has no effect frequency is not taken
>> stl(x)
>> Fehler in stl(x) : series is not periodic or has less than two periods

Please, read the error message carefully: ... has less than two 
periods... And you say you have series of one year. stl() cannot be used 
with so short series.

Otherwise, you must take care to define the time unit as year for using 
stl(), since it assumes that the periodic signal it extracts is of 
frequence one.

Best,

Philippe Grosjean

>> I googled for an answer but I couldn t find any. Is it really
>> necessary to transform my zoo objects to ts? how can I fix the
>> frequency-problem.
>> I hope you can help me.
>>
>> Thank you very much in advance and best regards,
>>
>> Markus
>>
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
> 
>



More information about the R-help mailing list