Time Series Analysis Lecture Notes Fall 2016 1 Lecture 1 1 Time Series Analysis and Forecasting 1.1 Introduction to Time Series 1.2 Learning Objectives Learn about different time-series forecasting models: moving averages, exponential smoothing, linear trend, quadratic trend, exponential trend, autoregressive models, and least squares models for seasonal data. Choose the most appropriate time-series forecasting model. The Importance of Forecasting Governments forecast unemployment rates, interest rates, and expected revenues from income taxes for policy purposes. Marketing executives forecast demand, sales, and consumer preferences for strategic planning. College administrators forecast enrollments to plan for facilities and for faculty recruitment. Retail stores forecast demand to control inventory levels, hire employees and provide training. Insurance Portfolios forecast. Figure 1: Beveridge Wheat Price Index, period = 370 years.
Time Series Analysis Lecture Notes Fall 2016 2 Time-Series Data Types of time series 1. continuous 2. discrete. Numerical data obtained at regular time intervals. The time intervals can be annually, quarterly, monthly, weekly, daily, hourly, etc. Time plot Example Year 2000 2001 2002 2003 2004 Sales 75.3 74.2 78.5 79.7 80.2 Time-Series Plot Non-Time-Series Data Point processes are a little similar to but are not time series Example 1. Dates of major railway disasters in the US are randomly spaced, they are not time series but rather a point process. 2 Simple Descriptive Techniques Types of Variation 1 Seasonal variation: sales figures and temperature readings exhibit variation that is annual in period.
Time Series Analysis Lecture Notes Fall 2016 3 Example 2. Unemployment is typically high in winter and lower in summer. 2 Cyclic variation: (a) variation at other fixed periods. Example 3. Daily variation in temperature high at noon, low at night. (b) Some time series exhibit oscillations without a fixed period, they are predictable to some extent. Example 4. Economic data are affected by business cycles. 3 Trend: long-term change in the mean level long term relative to the number of observations. Example 5. Climate variables exhibit cyclic variation over long periods. 4 Irregular fluctuations: after trend and cyclic variations have been removed, a series of residuals may or may not be random. (a) any cyclic variation is still left. (b) Probability models such as moving average (MA) or autoregressive (AR). Stationary Time Series: If there is no systematic change in mean (no trend), variance and if periodic variations have been removed. 2.1 Time Series Components Figure 2: Four components of the time series. Trend Component Seasonal Component
Time Series Analysis Lecture Notes Fall 2016 4 Figure 3: Time series with a trend component. Figure 4: Time series with a seasonal component. Figure 5: Time series with a cyclical component.
Time Series Analysis Lecture Notes Fall 2016 5 Cyclical Component Irregular Component Unpredictable, random, residual fluctuations. Due to random variations of Nature, Accidents or unusual events. Noise in the time series. Stochastic factors. Does The Time-Series have a Trend Component? A time-series plot should help answer this question. Often it helps if you smooth the time series data to help answer this question. Two popular smoothing methods are moving averages and exponential smoothing. 2.2 Transformations 1. To stabilize the variance. Time series exhibits trend and variance increases with mean, the std. dev. directly proportional to the mean. 2. To make the seasonal effect additive. multiplicative vs additive noise. 3. To make the data normally distributed. Model building and forecasting use normality assumption. Example 6. logarithmic, square root, reciprocal square root, Box-Cox. 4. In general, transforming the data is usually not a great idea except where doing so makes physical sense. Example: percentage data transformed using a log transform. 2.3 Time Series with a Trend The simplest model is given by where ɛ t N ( 0, σ 2 ɛ t ). X t = α + βt + ɛ t, model = linear trend + noise. The mean level at time t is given by µ t = E(X t ) = α + βt. Types of Trend Global trend.
Time Series Analysis Lecture Notes Fall 2016 6 1. Polynomial: linear trend quadratic trend. 2. Exponential. 3. Logistic. Local trend, e.g. piecewise linear. Stochastic trend. (State-Space Modelling). Approaches to Describe Trend 1 Curve fitting Regression. Example 7. Polynomial curve X t = α + βt X t = 0.4 + 2t. Example 8. Gompertz curve log X t = a + b r t log X t = 3 + 2 0.5 t. Example 9. Logistic curve X t = a 1+be ct X t = 0.7 1+0.3e 2t. 2 Filtering. Goal: measure trend and remove seasonal variation. Linear Filter Y t = s r= q a r X t+r. Y t is the linear operator, a r is the set of weights. If a r = 1 smooth out local fluctuations moving average. MA is often symmetric s = q and a j = a j. Example 10. a r = 1 2q+1 for r = q,, +q. The smoothed value of X t is given by Y t = Sm(X t ) = 1 2q + 1 If q = 3, then r = 3, 2, 1, 0, 1, 2, 3. q r= q X t+r. t 3, t 2, t 1, t, t + 1, t + 2, t + 3 Y t = 1 7 (X t 3 + X t 2 + X t 1 + X t + X t+1 + X t+2 + X t+3 ) Example 11. Suppose a r = ( 1 2) 2r 2 and q = 1, then r = 1, 0, 1. a 1 = a 1 = 1 4, a 0 = 1. Example 12. Suppose a r = ( 1 2) r 2 +1 and q = 1, then r = 1, 0, 1. a 1 = a 1 = 1 4, a 0 = 1 2.
Time Series Analysis Lecture Notes Fall 2016 7 2.4 Smoothing Methods Moving Averages Calculate moving averages to get an overall impression of the pattern of movement over time Averages of consecutive time series values for a chosen period of length L = 2q + 1. Exponential Smoothing SM(X t ) = A weighted asymmetric moving average. α(1 α) j X t j j=0 Moving Average Used for smoothing a series of arithmetic means over time. Result dependent upon choice of L = 2q + 1 (length of period for computing means). Last moving average of length L can be extrapolated one period into future for a short term forecast. For example: For a 5 year moving average, q = 2, L = 5. For a 7 year moving average, q = 3, L = 7. Five Year Moving Average Example 13. Y t = Sm(X t ) = 1 5 (X t 2 + X t 1 + X t + X t+1 + X t+2 ). First average: Second average: Y 3 = MA(5) = X 1 + X 2 + X 3 + X 4 + X 5 5 Y 4 = MA(5) = X 2 + X 3 + X 4 + X 5 + X 6 5 Annual Data Calculating Moving Averages Example 14.
Time Series Analysis Lecture Notes Fall 2016 8 Figure 6: Time plot for annual sales. Annual versus Moving Averages Figure 7: Time plot for annul sales vs 5-year moving average. 2.5 Residuals from Smoothed Data Res(X t ) = residual of the smoothed time series X t. q q Res(X t ) = X t Y t = X t a r X t+r = b r X t+r. r= q r= q b 0 = 1 a 0, and b r = a r for r 0. remover. If a r = 1 then b r = 0 the filter is a trend
Time Series Analysis Lecture Notes Fall 2016 9 The original moving average filter is called a low pass filter while the residual filter is a high pass filter. These ideas will be discussed further when we get to the spectral analysis of time series.