I am using spec.pgram(tsobj,spans=6, plot=TRUE) to obtain a periodogram for my univariate time series of monthly observations which were sampled over 86 years (so I have 1032 observations in total). It's defined as an object of class "ts" with frequency=12. The periodogram nicely depicts the seasonality for 1 year and has further peaks on following years. However, it stops at 6 years. I have reason to believe that there might be a seasonality with longer phase, say 8 years. How can I change the command to obtain values for longer seasonalities?

I am sorry, it sounds like a stupid question and possibly it is, but starring further on the help files, playing around with the available options and googling around didn't brought me any inside. Thanks alot for your help!

Here is the plot that I obtain: graph


What do you mean by "the periodogram [...] stops at 6 years". Do you mean cycles that are completed every 6 years? To make it clearer, you may post the graphic that you see or the data (the output from dput(tsobj).

I'm not sure I understood your question but it may be a misunderstanding of the x-axis.

With monthly data, the x-axis of the plot displayed by spec.pgram ranges from 0 to 6. The peak (if any) at point 0 in the periodogram is related to a long cycle of infinite period (a long-term trend).

The remaining peaks (if any) at points 1, 2, 3, 4, 5, 6 are related to seasonal frequencies, that is, cycles that are completed within one year. The first one is the annual cycle, which is completed once in a year; the second is the semianual and completes two cycles within a year, and so on. The numbers in the x-axis (from 0 to 6) indicate the number of cycles that are completed within a year by the corresponding cycle.

Cycles that are completed every, say, 6 years should show up between the vertical lines at x=0 and x=1 in the periodogram. Do you see many peaks in this range, if so, maybe you should change the period of your data.

  • 1
    $\begingroup$ Great! Thanks a lot! You're right, me dumb. I didn't got the meaning of the x-axis correctly. Sorry for ignorance. I added the plot (detrended), and you can see clearly the yearly seasonality. The spike at zero is of same height as the spike at 1 if I set detrend=FALSE, so this makes sense as well. Now, just in case you are still willing to help me further, there are some more open question marks: - If I change the period of my time series object, the resulting plot looks just the same but only the naming of the x-axis changes, this doesn't get me closer to seasonality over several years... $\endgroup$ – user1966337 Jul 2 '14 at 9:36
  • $\begingroup$ Moreover, I am wondering why detrending doesn't completely remove the spike at about zero (see graph), and finally, I am a bit confused by the fact that a simple repeated impulse (like rep(c(rep(0,11),1),86) = 86 "years" with an impulse of 1 every "december") shows up with spikes for all cycles 1 to 6 (meaning on higher frequence than a year?), but this pattern is not present in the plot for my clearly seasonal data given above...? $\endgroup$ – user1966337 Jul 2 '14 at 9:39
  • $\begingroup$ detrend=TRUE removes a linear trend. A linear trend may not fit well to the trend in your data and hence it may not be the best way to detrend this series. You can remove the trend by taking first differences to the data: spec.pgram(diff(tsobj), spans = 6) will most likely remove the long-term cycle from the data and the spike at frequency 0 in the periodogram. $\endgroup$ – javlacalle Jul 2 '14 at 10:36
  • $\begingroup$ A change in the period will not change the overall shape of the periodogram, just the features of the underlying cycles. For example if you set ts(tsobj, frequency = 4) the data are quarterly, with two seasonal cycles that are completed every quarter and two quarters. Looking at your plot the monthly frequency seems appropriate to me. You may find further details about this here. $\endgroup$ – javlacalle Jul 4 '14 at 11:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.