Erasmus Course on Time Series Analysis, May 2022211

Course taught at the University of Palermo, May 2022 by Dimitris Kugiumtzis

Sections:

Content

1. Introduction to time series analysis, stationarity and autocorrelation.
2. Linear models for stationary time series and non-stationary time series.
3. Prediction of time series.

 OHs

  1. Course 1, 2/5/2022, 15:15-18:00 
    Introduction to time series analysis, stationarity and autocorrelation (in PDF) [last updated 5/10/2021]
    Outline
    -- Examples of real-world time series
    -- Stationarity and autocorrelation
    -- Basic stochastic processes
    -- Removal of non-stationary components
    -- Independence test for time series

  2. Course 2, 3/5/2022 15:15-18:00
    Linear models for stationary time series and non-stationary time series (in PDF) [last updated 5/5/2022] 
    Outline
    -- Linear stationary stochastic processes: autoregressive (AR), moving average (MA) and ARMA.
    -- Fitting AR model to a time series
    -- Fitting MA model to a time series
    -- Fitting ARMA model to a time series
    -- Autoregressive integrated moving average (ARIMA) models

  3. Course 3, 5/5/2022 15:15-18:00
    Prediction of time series (in PDF) [last updated 5/10/2021] 
    Outline
    -- Simple prediction techniques
    -- Prediction of stationary time series with linear models
    -- Prediction of non-stationary time series with linear models

Ìatlab staff

Functions and programs in Matlab.

Non-stationary time series, removal of trend and seasonality, autocorrelation
- Function movingaveragesmooth.m : fitting the trend with a moving average filter of order 2q+1 (or 2q) (sliding local average, the first and last q points are blank).
- Function movingaveragesmooth2.m : fitting the trend with a moving average filter of order 2q+1 (or 2q) (use of function filtfilt of Matlab, the smoothin is applied to the whole time series, there are no blanks).
- Function polynomialfit.m : fitting the trend with a polynomial of a given degree.
- Function movingaverageseasonal.m : fitting the seasonality of period s with a moving average filter of order s (subtraction of the sliding local average, the first and last s/2 points are blank).
- Function seasonalcomponents.m : fitting the seasonality of period s by computing the mean of each periodic component.
- Function autocorrelation.m : computation of the sample autocorrelation function.
- Program rexampledetrending.m : example script for (a) generation of a time series with stochastic trend and seasonality, (b) removal of trend and seasonality, and (c) autocorrelation and independence test on the residual time series.

Linear models and prediction of time series
- For autoregressive models (AR) in Matlab you may want to look at function ar.m and generally for models ARMA see armax.m (these are in the toolbox system identification).
-
Function parautocor.m: computation of sample partial autocorrelation function.
-
Function fitARMA.m: fitting of model ARMA to the time series. The function gives in the output the parameters of AR and MA part, NRMSE for the given time steps ahead, AIC, FPE and residual variance.
- Function predictARMAnrmse.m: computation of NRMSE for prediction of the given time steps ahead using model ARMA on a given test set.
- Function predictARMAmultistep.m: computation of many steps ahead the given starting time point using a model ARMA on a given test set.
- Program rexamplearma.m: generation of a time series from an ARMA process, fitting of a selected ARMA model on the time series and predictions with this model.

Auxiliary functions
-
addstochastictrend.m : adds stochastic trend to the given time series.
- addseasonality.m : adds seasonality of given period to the given time series.
- pser.m : history diagram of the time series, possibly split to sub-plots for better visualization.
-
pserlarge.m : history diagram of the time series, possibly splitting to segments shown by vertical displacement.
- generateARMAts.m: generate a time series from a given ARMA process (the parameters of the process and the time series length are given as input arguments).
- nrmse.m: computation of the normalized root mean square error (NRMSE)
- myversion.m: this function is called in some other function to check the version of the Matlab running because there have been changes in different versions that affect the running of the program.
- plotnrmse.m: this function draws a plot of NRMSE(Ô) for prediction time steps  T=1…Tmax for different models. It requires that the NRMSE values of different models are given in respective columns all in one matrix.

Real-world time series:
-
ase.dat : The time series of daily index of the Athens Stock Exchange (ASE) from 1/1/2007 ôï 31/10/2011. The file contains a matric of 8 columns: 1: day, 2: month, 3: year, 4: opening price, 5: highest price, 6: lowest price, 7: closing price, 8: exchange volume.
-
epileeg.dat : Single channel electroencephalogram (EEG) from a human during epileptic seizure () [one column].
-
GICP.dat : Monthly general index of consumer prices (GPIC) in the period 1/2001 - 8/2005. The columns of interest are 1: year, 2: ìïíôç, 3: GICP index.
-
sunspots.dat : The annual sunspot numbers in the period 1700 - 2010. There are two columns 1: year, 4: sunspot number.
- crutem3nhannual.dat: The annual globe temperature index (ground temperature anomaly in the north hemisphere at grid 5ï x 5ï), period 1850 - 2011. The file contains a matrix of two columns, 1: year, 2: index.
- RR.dat : Hunab heart rate (time between two heart beats) [one column].
- USgnp.dat: Growth rate of the gross national product (GNP) of USA (at quarters of the year, from 2ï quarter 1947 ôï 1ï quarter 1991). The seasonality is removed. [one column]

All the Matlab files and data files are in the compressed file lab.zip.

Evaluation

- The evaluation is this short course will take place on Friday 6/5/2022, 16:10-17:10, after the one-hour class 15:00 - 16:00. The evaluation will be in written form and the students have to answer multiple choice questions and short narration questions.


Last updated on 5/5/2022 from Dimitris Kugiumtzis E-MAIL dkugiu@auth.gr