Code for plots in section 7.4

Hi everyone, in section 7.4 of FPP3 while comparing the performance of Fourier series in Time series data following code was shown in the video:-

fit_aus_cafe <- aus_cafe %>%
K1 = TSLM(log(Turnover) ~ trend() + fourier(K = 1)),
K2 = TSLM(log(Turnover) ~ trend() + fourier(K = 2)),
K3 = TSLM(log(Turnover) ~ trend() + fourier(K = 3)),
K4 = TSLM(log(Turnover) ~ trend() + fourier(K = 4)),
K5 = TSLM(log(Turnover) ~ trend() + fourier(K = 5)),
K6 = TSLM(log(Turnover) ~ trend() + fourier(K = 6))


Thereafter the plots were shown for different values of K. Can anyone help me with the code for those individual plots. I am able to get a combined plot for all K values.


I think we need to see your code and some sample data.

It might a/lso help if we knew what *section 7.4 of FPP3 * refers to.

Are you sure that was the right section? fit_beer using the aus_production dataset is used in the videos:

7.4 Some useful predictors | Forecasting: Principles and Practice (3rd ed) (

The code used in the slides is shown here:

1 Like

Thats important tips you have provided for posting question on this forum. I ll keep them in mind next time onwards. VMT.

Thank You Sir. Your book has been a very important source for learning about time series forecasting and it has helped immensely in my line of work. Initially I was not very comfortable with time series forecasting but after reading the book I feel pretty confident now.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.