So suppose we have some sort of a time series model.
y_t = trend_t + cyclical_t + x_t + epsilon_t
So, I'm interested in obtaining the seasonal component. Here "x_t" refers to other potential covariates.
I can fit a trend with a moving average so now I have
y_t = y_t - trend_t
So now this is a stationary time series.
But now, I'd like to write some sort of a periodic function which will capture how this function varies seasonally.
Generally, we do that by computing some sort of a approximation of y using fourier series. This will have the property that our function is periodic, and we can limit how closely it matches "y" by limiting the number of terms in the function.
So then problem I run into is that most statistical programs for computing "fourier series" or "fast fourier transforms" or whatever don't seem to take the parameters I would expect the function to take as an input.
Specifically, I would expect any function of this sort to require "Periodicity" (ie, when the function repeats) and the number of terms in the fourier series (ie, how closely we're matching the original data).
Can anyone tell me what I'm missing?