[R] detrending a time series

rdporto rdporto1 at terra.com.br
Tue Oct 16 20:46:08 CEST 2007


Chris,

if you really want to use the stl() function, one possible solution
is to do

my.ts=ts(my.ts,start=1800,frequency=2).

Rogerio

--- Original Message ---

From: Christoph Scherber <Christoph.Scherber_at_agr.uni-goettingen.de> 
Date: Wed, 10 Oct 2007 16:16:39 +0200


Dear R users, 
I am trying to ´detect´ the trend in an artificial time series created by the simple function 
x=seq(pi,10*pi,0.1) 
my.ts=0.1*x+sin(x) 
my.ts=ts(my.ts,start=1800) 
plot(my.ts) 
I have tried stl(my.ts), but because I don´t have ´replications´ at every time point, this somehow doesn´t work. 
How could I best detect the trend in the ts? 
I would very much appreciate any help! 
Thanks a lot in advance 
Christoph 
(using R 2.6.0 on Windows XP)



More information about the R-help mailing list