Hi, I'm trying to use R to detrend a time series...(adsbygoogle = window.adsbygoogle || []).push({});

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

**Physics Forums - The Fusion of Science and Community**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

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

Can you offer guidance or do you also need help?

Draft saved
Draft deleted

Loading...

Similar Threads - Help window looking | Date |
---|---|

B Super basic polynomial and exponent definition help | Feb 20, 2018 |

I Question about the Divisor Function/Sums and Project Euler | Feb 16, 2018 |

B Using trig to find distance? | Jan 18, 2018 |

I Help manipulating a Physics equation | Nov 15, 2017 |

Minimum time window needed to capture frequencies | Dec 8, 2014 |

**Physics Forums - The Fusion of Science and Community**