time series analysis using sas prepared by john fahey (former load forecaster at nspi) and voytek...

12
Time Series Analysis using SAS prepared by John Fahey (former Load Forecaster at NSPI) and Voytek Grus (former Sales and Revenue Forecaster at BC Gas Inc.) for SAS user group, Halifax February 6, 2009

Post on 18-Dec-2015

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Time Series Analysis using SAS prepared by John Fahey (former Load Forecaster at NSPI) and Voytek Grus (former Sales and Revenue Forecaster at BC Gas Inc.)

Time Series Analysis using SAS

prepared by

John Fahey (former Load Forecaster at NSPI)

andVoytek Grus

(former Sales and Revenue Forecaster at BC Gas Inc.) for

SAS user group, Halifax February 6, 2009

Page 2: Time Series Analysis using SAS prepared by John Fahey (former Load Forecaster at NSPI) and Voytek Grus (former Sales and Revenue Forecaster at BC Gas Inc.)

Overview

• A little bit about Times Series Analysis in general.

• Statistical tools available in SAS to conduct Analysis.

• Empirical example using SAS

Page 3: Time Series Analysis using SAS prepared by John Fahey (former Load Forecaster at NSPI) and Voytek Grus (former Sales and Revenue Forecaster at BC Gas Inc.)

What is Time Series Analysis?

• Time Series - a sequence of data points, measured typically at successive times.

• Times Series Analysis is a collection of statistical techniques used to understand time series by trying to find an internal mechanism that explains their behavior.

– Series decomposition; trend, cyclicality, seasonality, irregularity (random effect)

– A central idea to Time series analysis is that it is a statistical (stochastic) process but it has not always been this way…

• Time series analysis ≠ Forecasting

• Applications

Page 4: Time Series Analysis using SAS prepared by John Fahey (former Load Forecaster at NSPI) and Voytek Grus (former Sales and Revenue Forecaster at BC Gas Inc.)

A little bit of history…

– Time a mysteries concept – TS considered a deterministic concept

– XIX century – explain TS in terms of trigonometric fcns (fourier series).

– 1927 – Udny Yule introduced statistical approach (sun-spot studies)

– 1950’s and 60’s regression with error modeling (econometrics)

– 1960’s state space models (Kalman filter or Bayesian Forecasting)

– Mid 1970’s Box Jenkins introduced ARIMA models Other: multivarate time series, non-linear models, bi-spectra

Page 5: Time Series Analysis using SAS prepared by John Fahey (former Load Forecaster at NSPI) and Voytek Grus (former Sales and Revenue Forecaster at BC Gas Inc.)

Approaches to time series analysis.

• Analysis in time domain. – Trend extrapolation: use linear, polynomials, & sine waves functions

for trend extrapolation. (regression and auto regression)– Moving Averages: fit in polynomial of order p to the last (2m+1) points. – Exponential smoothing

• Winters, Holt-Winters, Harrison (additive vs multiplicative models)

– ARIMA models (differencing, stationarity, correlograms)• Dynamic regression (arimax)

– Statespace / structural models: decompose series into trends, cycle, season, and white noise.

– Mulitvariate time series – feedback loop effect– Non-linear models: poly-spectra, bi-linear, random coefficients etc.

• Analysis in frequency domain – – spectrum analysis (periodograms, harmonics)– Wavelet analysis

Page 6: Time Series Analysis using SAS prepared by John Fahey (former Load Forecaster at NSPI) and Voytek Grus (former Sales and Revenue Forecaster at BC Gas Inc.)

Introduction: TS 3 stage process with 6 Analytical Steps

Data ScreeningTrends,

seasonal effect, outliers

AdjustmentsTransformations,

Trend removal, etc

IdentificationsExamine serial

correlation structure

EstimationEstimate

parameters

Model CheckingGoodness of fit,

residuals

Forecasting

Page 7: Time Series Analysis using SAS prepared by John Fahey (former Load Forecaster at NSPI) and Voytek Grus (former Sales and Revenue Forecaster at BC Gas Inc.)

Identification: Correlogram of SACF (non-stationary series)

Page 8: Time Series Analysis using SAS prepared by John Fahey (former Load Forecaster at NSPI) and Voytek Grus (former Sales and Revenue Forecaster at BC Gas Inc.)

Identification: Correlogram of SACF (stationary series)

Page 9: Time Series Analysis using SAS prepared by John Fahey (former Load Forecaster at NSPI) and Voytek Grus (former Sales and Revenue Forecaster at BC Gas Inc.)

TS Analysis using SAS

• SAS procedures– Analysis in time domain:

• Trend extrapolation: proc autoreg, proc reg, proc forecast

• Box Jenkins: proc arima.

• Trend decomposition: proc X11, proc satespace, proc ucm.

• Multivariate analysis: proc varmax.

– Analysis in frequency domain: proc spectra.

• SAS/ETS Time Series Forecasting System – Window-based pull-down menus environment (Solutions/Analysis/Time

Series Forecasting System)

• Enterprise Guide 3.0– Point and click

• SAS Matrix programming language.

Page 10: Time Series Analysis using SAS prepared by John Fahey (former Load Forecaster at NSPI) and Voytek Grus (former Sales and Revenue Forecaster at BC Gas Inc.)

How to get started?

- SAS help- Chapter 34 of “Getting started with time series

forecasting” gives a good overview of TS forecasting system using drop down windows.

- Provides outline of the forecasting process- Specify data inputs- Provide a valid time ID- Select and Fit a forecasting model for each series- Produce the forecasts- Save your work

- Concept of time and date measurement in SAS.

Page 11: Time Series Analysis using SAS prepared by John Fahey (former Load Forecaster at NSPI) and Voytek Grus (former Sales and Revenue Forecaster at BC Gas Inc.)

Some Literature

• Time Series Third Edition Sir Maurice Kendall and J Keith Ord (1990)

• Classical and Modern Regression with Applications Raymond H. Myers (1986)

• Applied Linear Regression by Sanford Weisberg ( 1985)

• SAS Help Examples

Page 12: Time Series Analysis using SAS prepared by John Fahey (former Load Forecaster at NSPI) and Voytek Grus (former Sales and Revenue Forecaster at BC Gas Inc.)

Questions?