Generally, a model for time-series forecasting can be written as

where yₜ is the variables to be forecasted (dependent variable, or response variable), t is the time at which the forecast is made, h is the forecast horizon, Xₜ is the variables used at time t to make forecast (independent variable), θ is a vector of parameters in function g, and εₜ₊ₕ denotes errors. It is worth noting that the observed data is uniquely orderly according to the time of observation, but it doesn’t have to be dependent on time, i.e. time (index of the observations) doesn’t have to be one of the independent variables.

## Some possible properties of time series

Stationarity: a stationary process is a stochastic process, whose mean, variance and autocorrelation structure do not change over time. It can also be defined formally using mathematical terms, but in this article, it’s not necessary. Intuitively, if a time series is stationary, we look at some parts of them, they should be very similar — the time series is flat looking and the shape doesn’t depend on the shift of time. (A quick check of knowledge: is f(t) = sin(t) a stationary process? It surely isn’t, since it’s not stochastic, stationarity is not one of its properties)

Figure 1.1 shows the simplest example of a stationary process — white noise.

The above image Figure 1.2 shows a non-stationary time series. Why is it so? We can see the obvious trend, it means that the variance changes over time. But if we use linear regression to fit a line to it (to capture the trend) and remove the trend the data now has a constant location and variance, but it’s still not stationary because of periodic behavior, which is not stochastic.

When using ARMA to model a time series, one of the assumptions is that the data is stationary.

Seasonality: Seasonality is the property of showing certain variations in a specific time interval that is shorter than a year (it can be over a different period of course. If we are observing the hourly temperature in a day and collect data over a couple of days, then the period is a day and it can also have seasonality — peaks might appear at 2 or 3 pm. This means we…