How to do it...

We will work with the steel production for Argentina. This is a monthly series collected from January 1993 to December 2018. We will analyze this time series according to its spectral density:

  1. First, we load the dataset and we plot it. The evident problem here is that the series has a trend. Spectral analysis cannot be carried out with a trend, because low-frequency components will dominate (think of the trend as a component transmitting information between data points, separated through time). The more linear the trend is, the more profound this effect will be. Note that this trend is nonlinear:
library(imputeTS) library(timesboot) butane =  read.csv("./steel.csv") butane = ts(butane$valor,start=c(1993,1),frequency = 12) ...

Get R Statistics Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.