# Fourier Output Meaning

I just ran a fourier series on weekly sales data for 3 years worth of data.

I optimally chose the number of k-terms based on the AIC.

First 6 lines of my data:

sales_df<- ts(for_seasonality, freq=365.25/7, start=2015)
sales_df

Time Series:
Start = 2015
End = 2018.64134154689
Frequency = 52.1785714285714
sales_sum
[1,]  16784338
[2,]  15996710
[3,]  16955621
[4,]  17353905
[5,]  19158498
[6,]  20850803


Here is my function:

seasonality<-data.frame(fourier(sales_df, K=6))


Here are the first 6 lines of my output:

  S1.52     C1.52     S2.52     C2.52     S3.52      C3.52     S4.52      C4.52      S5.52      C5.52      S6.52      C6.52
1 0.1201262 0.9927586 0.2385126 0.9711394 0.3534447  0.9354554 0.4632579  0.8862235  0.5663619  0.8241566  0.6612635  0.7501537
2 0.2385126 0.9711394 0.4632579 0.8862235 0.6612635  0.7501537 0.8211001  0.5707842  0.9335419  0.3584683  0.9920985  0.1254612
3 0.3534447 0.9354554 0.6612635 0.7501537 0.8837203  0.4680153 0.9920985  0.1254612  0.9724076 -0.2332885  0.8271893 -0.5619233
4 0.4632579 0.8862235 0.8211001 0.5707842 0.9920985  0.1254612 0.9373419 -0.3484108  0.6692904 -0.7430009  0.2489398 -0.9685190
5 0.5663619 0.8241566 0.9335419 0.3584683 0.9724076 -0.2332885 0.6692904 -0.7430009  0.1307927 -0.9914097 -0.4537031 -0.8911529
6 0.6612635 0.7501537 0.9920985 0.1254612 0.8271893 -0.5619233 0.2489398 -0.9685190 -0.4537031 -0.8911529 -0.9296339 -0.3684844


I know I am supposed to add them together to get the "seasonality variable" for modelling. I am more interested in the meaning behind each of these columns.

If anyone has any insights or articles pertaining to this, it would be really helpful. Thanks!

I also tried this for the first value, and it doesn't match with the output.

This output is 0.541298 where the r-output is 0.1201.

• Do you understand what is Fourier analysis decomposition? The reason I'm asking is because I never used this function before, but can guess what the output means by knowing what Fourier analysis is. So, if we know what you know about the subject, you'll get better help – Aksakal Oct 29 '18 at 21:22
• – Rob Hyndman Oct 29 '18 at 21:55
• $\sin\left(\frac{2\pi\times 1}{365.25/7}\right)= 0.12012616518235052$; $\sin\left(\frac{2\pi\times 2}{365.25/7}\right)=0.2385125751940.$ – Antoni Parellada Oct 29 '18 at 23:06
• $\cos\left(\frac{2\pi\times 1}{365.25/7}\right)=0.9927586335250793$ ... $\sin\left(\frac{4\pi\times 1}{365.25/7}\right)=0.2385125751940764$... – Antoni Parellada Oct 29 '18 at 23:44
• It would seem that the "output" in your OP are the basis vectors and harmonics. Then you will actually need the coefficients require(fpp2); tslm(sales ~ trend + fourier(sales_df, K=6)) or something along these lines, which will allow you to predict your actual sales values, such as [1,] 16784338. – Antoni Parellada Oct 29 '18 at 23:58