Introduction to Time Series I

Gustavo MagaƱa & Edwin Bedolla

Created 5th April 2020, edited on 1st November 2020

This document gathers some main concepts in time series analysis as well as some examples written for the Python programming language. First we import all the necessary libraries.

Definitions

Let's start by defining stochastic processes: A family of indexed random variables \(Z(\omega, t)\) where \(\omega\) belongs to a sample space and \(t\) belongs to an index set.

  • For a given \(\omega\), \(Z(\omega, t)\) as a function of \(t\) is called a sample function or realisation.
  • The population that consists of all possible realisations is called the ensemble.
  • A time series is a collection of random variables indexed in a ordered set representing time periods.

Examples

1. White noise

For example, one of the basic time series is white noise, which is a time series generated from uncorrelated variables, which are most of the time normally distributed.

This collection of random variables \(\{x_t\}\) has the following properties:

\[\mu_x = 0\]

\[\sigma^2_x = 1\]

  • They are independently and identically distributed such that

\[ x_t \sim i.i.d. \mathcal{N}(0, 1) \]

We can see that this time series is very noisy, with big peaks all over the place; if we wanted to do some meaningful analysis on it we might have a difficult time. Instead we can apply a very simple smoothing technique named the moving average.

2. Moving average

The moving average is an actual time series in itself defined as

\[ v_t = \frac{1}{N} \sum_{i=0}^{N-1} w_{t-i} \]

this means that the moving average takes as input the neighboring values in the past and future time periods and evaluates them, obtaining the realization as an arithmetic mean. The following example applies a moving average to a white noise time series.