I am using the forecast package in R to get some Fourier components - namely, function fourier(ts, K, ..). For a time series ts, K controls the maximum number of the Fourier terms one gets (sines + cosines of with different frequencies).

However, if the period of the time series is specified as 7, K is automatically capped at 3 maximum, or for other periods, $\#\textrm{terms} = \frac{\textrm{Period}}{2}$.

Why is that? I thought Fourier series can be represented by an infinite number of components. Is there some practical issue?


You are observing a discrete series. With a period of $k$ and a constant term already fitted, there are only $k-1$ degrees of freedom for the seasonal terms (there's only $k$ different means you can have in a period with $k$ times, but one is accounted for by the constant). This is the same df you get if you used seasonal dummies.

Because you have both $\sin$ and $\cos$ terms, you normally get two terms each harmonic. So with $k=7$, you get $(k-1)/2=3\,$ $\sin$ terms and $(k-1)/2=3\,$ $\cos$ terms. (With even $k$, you get one term at the end rather than two, because one - the highest order $\sin$ term - doesn't contribute anything.)

Any higher order periodicities would consist of wiggles between the data points. You don't observe those.

  • $\begingroup$ Ah, so it is due to the function being discrete? So, as I understood, the first 7 terms approximate all 7 points of the period, while higher order terms try to approximate something which is in-between points, so it makes no sense (since the ts is discrete), and they are simply discarded. Did I get it correctly? $\endgroup$ – SWIM S. Jan 20 at 3:03
  • 1
    $\begingroup$ Essentially, yes; being on a discrete set of points you can only determine as many coefficients as points - and because the points are on a lattice, higher harmonics couldn't do anything anyway. $\endgroup$ – Glen_b Jan 20 at 5:14

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.