1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

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

  1. Nov 23, 2012 #1
    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
     
    Last edited: Nov 23, 2012
  2. jcsd
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted



Similar Discussions: Help with s.window in [R] when looking at monthly time series
  1. Help with a series (Replies: 12)

  2. R^2=8 help (Replies: 11)

Loading...