Help with s.window in [R] when looking at monthly time series


by joanne34567
Tags: r project, s.window, time series
joanne34567
joanne34567 is offline
#1
Nov23-12, 11:02 AM
P: 13
Hi, I'm trying to use R to detrend a time series...
I have monthly temperature data covering 120 months from 2008 which are measured in degrees.
I'm trying to use the following script but am getting errors and I'm not sure why...
Any ideas??

#this is creating the timeseries
timeseries = ts(temp, freq=120, start=c(2008, 1))

sthis should plot the series
plot(stl(timeseries), s.window="periodic")

This is where I get the following error:

Error in plot(stl(timeseries), s.window = "periodic") :
error in evaluating the argument 'x' in selecting a method for function 'plot': Error in stl(timeseries) :
series is not periodic or has less than two periods

I'm not sure why as there is 10 years worth of data... Can anyone help?


Here is a sample of the data I'm using... Each number represents the temperature for a month starting Jan 2008

-1.4 4.3 7.9 9.4 10.0 5.0 1.1 -5.6 -5.2 -4.4 -8.3 -3.2 -0.8 5.6 6.4
9.5 9.1 7.9 2.7 -3.8 -6.0 -6.4 -4.8 -3.7 0.5 5.5 9.0 6.9 10.2 6.7
2.9 -2.2 -2.8 -5.4 -5.4 -1.8 -2.5 6.0 5.9 9.4 10.7 2.6 5.9 -2.8 -7.6
-4.2 -3.4 -1.9 -1.1 4.2 9.7 9.3 8.7 4.4 2.1 -1.3 -3.3 -7.1 -8.4 -2.2
-1.3 5.8 12.2 10.4 12.9 6.3 -0.4 0.0 -4.0 -7.4 -5.6 -4.5 -0.7 2.0 7.0
9.0 9.7 6.9 4.1 -2.4 -3.5 -6.4 -9.7 -3.8 -0.2 4.6 8.5 8.5 7.4 7.0
4.9 -3.0 -7.3 -6.1 -6.9 -5.4 -0.3 3.8 8.2 12.5 5.8 9.2 5.5 0.1 -1.9
-3.0 -3.0 -3.2 3.7 5.0 8.2 8.6 8.6 4.3 2.3 -3.3 -4.5 -2.8 -3.2 -5.1
Phys.Org News Partner Mathematics news on Phys.org
Math modeling handbook now available
Hyperbolic homogeneous polynomials, oh my!
Researchers help Boston Marathon organizers plan for 2014 race

Register to reply

Related Discussions
What is coincidence time window Quantum Physics 0
Monthly chores General Discussion 2
IE will only let one window up at a time.. Computing & Technology 13
Need your help about this monthly cycle Biology 5