2

I am performing a Seasonal and Trend Decomposition by Loess on a yearly time series, where I extract a long term trend and tri-annual quasi-periodic series from the raw data. The problem is that it doesn't seem to exist an option of ts with periodicity on the order of years. Nevertheless, I was able to overcome this limitation by running the analyses with a random frequency for the TS and the final results were satisfactory:

loessyearly <- ts(yrobs, start = 1993, frequency = 2) #create a TS with random frequency of 2
stlyearly <- stl(loessyearly, s.window = 3, t.window = 9) #s.window = 3 to smooth under a quasi-periodicity of three years

Obviously, when plotting the graphs the X-axis follows the frequency I choose at random (i.e. 2 years):

STL graph

However, I would like the x-axis to depict one year per each observation (i.e. frequency = 1). Is that possible?

I know an option would be trying this decomposition with stlplus(), but I would like to try it via stl() first, since I found it even more difficult o deal with the graphical options of the stlplus() function. Thank you!

sfjac
  • 7,119
  • 5
  • 45
  • 69
  • Try this: par(xaxt="n");plot(stl(loessyearly, s.window = 3, t.window = 9));par(xaxt="s"); axis(side = 1, at=seq(1993,2005,1), labels=seq(1993,2005,1), las = 2) – Edgar Santos Jul 10 '17 at 00:41
  • Unfortunately it still doesn't work. It still jumps two observations per year... – Jose Francisco Jul 10 '17 at 23:44

0 Answers0