# A First Course on Time Series Analysis with SAS

"A First Course on Time Series Analysis with SAS" is an open source book project to create a mathematically oriented introduction to time series analysis. You can download the book (in pdf-format) as well as the data sets and the SAS programming code free of charge.

It is also possible to directly order a printed copy of the the book.

If you are interested in making changes to the book please read the preamble.

## Introduction

The analysis of real data by means of statistical methods with the aid of a software package common in industry and administration usually is not an integral part of mathematics studies, but it will certainly be part of a future professional work.

The present book links up elements from time series analysis with a selection of statistical procedures used in general practice including the statistical software package SAS. Consequently this book addresses students of statistics as well as students of other branches such as economics, demography and engineering, where lectures on statistics belong to their academic training. But it is also intended for the practician who, beyond the use of statistical tools, is interested in their mathematical background. Numerous problems illustrate the applicability of the presented statistical procedures, where SAS gives the solutions. The programs used are explicitly listed and explained. No previous experience is expected neither in SAS nor in a special computer system so that a short training period is guaranteed.

This book is meant for a two semester course (lecture, seminar or practical training) where the first three chapters can be dealt within the first semester. They provide the principal components of the analysis of a time series in the time domain. Chapters 4, 5 and 6 deal with its analysis in the frequency domain and can be worked through in the second term. In order to understand the mathematical background some terms are useful such as convergence in distribution, stochastic convergence, maximum likelihood estimator as well as a basic knowledge of the test theory, so that work on the book can start after an introductory lecture on stochastics. Each chapter includes exercises. An exhaustive treatment is recommended. Chapter 7 (case study) deals with a practical case and demonstrates the presented methods. It is possible to use this chapter independent in a seminar or practical training course, if the concepts of time series analysis are already well understood.

This book is consecutively subdivided in a statistical part and an SAS-specific part. For better clearness the SAS-specific parts are highlighted.

The purpose of this internet-based open-source project is to make a useful document "free" in the sense of freedom: to assure everyone the effective freedom to copy and redistribute it, with or without modifying it, either commercially or noncommercially. That's why we put this project under the GNU Free Documentation License.

A traditional book, once published, allows no modifications, extensions, corrections etc. unless a new edition is released. This is the reason why we put the source code of the book (in latex-format) on the internet for free download as well: Once downloaded, the source code allows you to modify the text just as you like.

The book is released on a print-on-demand basis. Print-on-Demand means that the book is printed only when it has been previously ordered. Hence, all improvements to the online version of the book will directly translate to the printed version.

In case you have modifications, extensions etc. which might be of interest to a broader audience, you can send them to us and we will incorporate them in a future version of the document. We hope that, as time goes by, evolution takes place and leads to a steadily improving text

Copyright © 2012 Michael Falk. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".

The authors accept no responsibility for errors in the programs mentioned or their consequences.

SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute in the USA and other countries. Windows is a trademark, Microsoft is a registered trademark of the Microsoft Corporation.

Here you can download the book as pdf (version: 2012.August.01, 2.6 MB).

1. Elements of Exploratory Time Series Analysis
1. The Additive Model for a Time Series
2. Linear Filtering of Time Series
3. Autocovariances and Autocorrelations
4. Exercises
2. Models of Time Series
1. Linear Filters and Stochastic Processes
2. Moving Averages and Autoregressive Processes
3. The Box–Jenkins Program
4. Exercises
3. State-Space Models
1. The State-Space Representation
2. The Kalman-Filter
3. Exercises
4. The Frequency Domain Approach of a Time Series
1. Least Squares Approach with Known Frequencies
2. The Periodogram
3. Exercises
5. The Spectrum of a Stationary Process
1. Characterizations of Autocovariance Functions
2. Linear Filters and Frequencies
3. Spectral Density of an ARMA-Process
4. Exercises
6. Statistical Analysis in the Frequency Domain
1. Testing for a White Noise
2. Estimating Spectral Densities
3. Exercises
7. The Box–Jenkins Program: A Case Study
1. Partial Correlation and Levinson–Durbin Recursion
2. Asymptotic Normality of Partial Autocorrelation Estimator
3. Asymptotic Normality of Autocorrelation Estimator
4. First Examinations
5. Order Selection
6. Diagnostic Check
7. Forecasting
8. Exercises
8. Bibliography
9. Index
10. SAS-Index
11. GNU Free Documentation Licence

## Source Code

The LaTeX source code is published under the GNU Free Documentation License.

You can get one zip-file (version: 2012.August.01, 2.3 MB) containing all the files you need.

## Version History

The book is also released on a print-on-demand basis. Print-on-Demand means that the book is printed only when it has been previously ordered. Hence, you will always get the newest version of the book.

You can order the book directly from our print-on-demand publisher epubli.com or buy it direcly from Amazon.de Marktplace. It's also possible to buy the book from local bookstores with the book ISBN 978-3-8442-2845-8.

The following table gives an overiew ot the used data sets. You can also download one file containing the zipped raw data (for version: 2012.August.01, 59 KB).

Dataset Raw data SAS data
Airline Data airline.txt airline.sas7bdat
Bankruptcy Data bankrupt.txt bankrupt.sas7bdat
Car Data cardata.txt
Donauwörth Data donauwoerth.txt donauwoerth.sas7bdat
Electricity Data electric.txt electric.sas7bdat
Gas Data gas.txt
Hog Data (price) hogprice.txt hogprice.sas7bdat
Hog Data (supply) hogsuppl.txt hogsuppl.sas7bdat
Hongkong Data hongkong.txt hongkong.sas7bdat
Income Data income.txt
IQ Data iq.txt iq.sas7bdat
Nile Data nile.txt
Population1 Data population1.txt
Population2 Data population2.txt
Public Expenditures Data pubexpen.txt
Share Data share.txt
Star Data star.txt
Sunspot Data sunspot.txt sunspot.sas7bdat
Temperatures Data temperatures.txt
Unemployed Females Data female.txt
Unemployed1 Data unemployed1.txt
Unemployed2 Data unemployed2.txt
US Interest Rates Data us_interest_rates.txt us_interest_rates.sas7bdat
Zurich Data zurich.txt

## Version History

The following table gives an overiew ot the used SAS programs. You can also download one file containing all zipped SAS programs (for version: 2012.August.01, 30 KB).

Program SAS code
airline_kalman airline_kalman.sas
airline_log airline_log.sas
airline_plot airline_plot.sas
airline_whitenoise airline_whitenoise.sas
airline_whitenoise_plot airline_whitenoise_plot.sas
aliasing aliasing.sas
ar1_autocorrelation ar1_autocorrelation.sas
ar1_plot ar1_plot.sas
ar1_sd ar1_sd.sas
ar2_epa ar2_epa.sas
ar2_plot ar2_plot.sas
arma11_autocorrelation arma11_autocorrelation.sas
arma11_sd arma11_sd.sas
arma11_sd2 arma11_sd2.sas
bankruptcy_correlogram bankruptcy_correlogram.sas
bankruptcy_periodogram bankruptcy_periodogram.sas
donauwoerth_dcheck1 donauwoerth_dcheck1.sas
donauwoerth_dcheck2 donauwoerth_dcheck2.sas
donauwoerth_dcheck3 donauwoerth_dcheck3.sas
donauwoerth_final donauwoerth_final.sas
donauwoerth_firstanalysis donauwoerth_firstanalysis.sas
donauwoerth_forecasting donauwoerth_forecasting.sas
donauwoerth_orderselection donauwoerth_orderselection.sas
donauwoerth_overfitting donauwoerth_overfitting.sas
donauwoerth_pacf donauwoerth_pacf.sas
electricity_differences electricity_differences.sas
females females.sas
gompertz gompertz.sas
hog hog.sas
hog_cointegration hog_cointegration.sas
hog_dickey_fuller hog_dickey_fuller.sas
hongkong_pa hongkong_pa.sas
hongkong_plot hongkong_plot.sas
logistic logistic.sas
ma1_blackman_tukey ma1_blackman_tukey.sas
ma1_logdsae ma1_logdsae.sas
ma1_sd ma1_sd.sas
mkfields mkfields.sas
population1 population1.sas
power_transfer_fodf power_transfer_fodf.sas
power_transfer_sdf12 power_transfer_sdf12.sas
power_transfer_sma3 power_transfer_sma3.sas
sample sample.sas
star_harmonic star_harmonic.sas
star_periodogram star_periodogram.sas
sunspot_correlogram sunspot_correlogram.sas
sunspot_dsae sunspot_dsae.sas
temperatures temperatures.sas
transfer transfer.sas
unemployed1_listing unemployed1_listing.sas
unemployed1_plot unemployed1_plot.sas
unemployed1_x11 unemployed1_x11.sas

## Version History

If you would like to support our work on "A First Course on Time Series Analysis with SAS", feel free to give us a donation.

Our bank details are:

 Account holder: Staatsoberkasse Bayern in Landshut Bank: BBK Regensburg Bank identification code: 750 000 00 Account number: 743 015 40 Swift-adress/BIC: MARKDEF1750 IBAN: DE08 7500 0000 0074 3015 40

VERY IMPORTANT: Please, state 1517010/824030-1 as reason for transfer.

Chair of Statistics
University of Würzburg
Emil-Fischer-Str. 30
D-97074 Würzburg
Germany

Telephone: (+49-931) 31-84938
Fax: (+49-931) 31-84949
E-Mail: falk@mathematik.uni-wuerzburg.de

We would like to thank our contributors whose efforts make this TimeSeries Project possible. They have created and maintained the book and our web site.

(alphabetic order)

• Peter Dinges
• Stefan Englert, Institute of Medical Biometry and Informatics, University of Heidelberg
• Michael Falk, Institute of Mathematics, University of Würzburg
• Daniel Hofmann
• Frank Marohn, Institute of Mathematics, University of Würzburg
• René Michel, Altran CIS
• Maria Macke
• Christoph Spachmann
• Bernward Tewes, University Computer Center of the Catholic University of Eichstätt-Ingolstadt