Introduction to Time Series Using
Stata
Revised Edition
SEAN BECKETTI
A Stata Press Publication
StataCorp LLC
College Station, Texas
Copyright 2013, 2020 by StataCorp LLC
All rights reserved. First edition 2013
Revised edition 2020
Published by Stata Press, 4905 Lakeway Drive, College Station, Texas 77845
Typeset in L A T E X
Printed in the United States of America
Print ISBN-10: 1-59718-306-7
Print ISBN-13: 978-1-59718-306-2
ePub ISBN-10: 1-59718-307-5
ePub ISBN-13: 978-1-59718-307-9
Mobi ISBN-10: 1-59718-308-3
Mobi ISBN-13: 978-1-59718-308-6
Library of Congress Control Number: 2020932011
No part of this book may be reproduced, stored in a retrieval system, or transcribed, in any form or by any meanselectronic, mechanical, photocopy, recording, or otherwisewithout the prior written permission of StataCorp LLC.
Stata, , Stata Press, Mata, , and NetCourse are registered trademarks of StataCorp LLC.
Stata and Stata Press are registered trademarks with the World Intellectual Property Organization of the United Nations.
NetCourseNow is a trademark of StataCorp LLC.
L A T E X is a trademark of the American Mathematical Society.
Contents
1.1
1.1.1
1.1.2
1.1.3
1.1.4
1.1.5
1.2
1.3
1.4
1.4.1
1.4.2
1.5
1.6
1.6.1
1.6.2
1.7
1.8
2.1
2.2
2.3
2.3.1
2.3.2
2.3.3
2.4
2.5
2.5.1
2.5.2
3.1
3.1.1
3.1.2
3.2
3.3
3.3.1
3.3.2
3.3.3
3.3.4
3.4
3.4.1
3.4.2
3.4.3
3.5
4.1
4.1.1
4.1.2
4.1.3
4.2
4.2.1
4.2.2
4.3
4.4
5.1
5.1.1
5.2
5.2.1
5.2.2
5.3
5.3.1
5.4
5.4.1
5.4.2
5.4.3
5.5
5.6
6.1
6.2
6.3
6.4
6.5
6.6
6.7
7.1
7.2
7.3
7.3.1
7.3.2
7.4
7.5
7.5.1
7.5.2
7.6
7.7
7.8
7.9
7.10
8.1
8.2
8.3
8.3.1
8.3.2
8.4
9.1
9.1.1
9.2
9.2.1
9.2.2
9.2.3
9.3
9.3.1
9.3.2
9.4
9.4.1
9.4.2
9.5
9.6
10.1
10.2
10.3
10.4
10.4.1
10.5
10.6
10.7
11.1
11.2
11.2.1
11.2.2
11.3
Tables
Figures
Preface
Welcome.
Time-series analysis is a relatively new branch of statistics. Most of the techniquesdescribed in this book did not exist prior to World War II, and many of the techniques datefrom just the last few decades. The novelty of these techniques is somewhat surprising, giventhe importance of forecasting in general and of predicting the future consequences of todayspolicy actions in particular. The explanation lies in the relative difficulty of the statisticaltheory for time series. When I was in graduate school, one of my econometrics professorsadmitted that he had switched his focus from time series when he realized he could producethree research papers a year on cross-section topics but only one paper per year on time-seriestopics.
Why another book on time series?
The explosion of research in recent decades has delivered a host of powerful and complex toolsfor time-series analysis. However, it can take a little while to become comfortable withapplying these tools, even for experienced empirical researchers. And in industry, these toolssometimes are applied indiscriminately with little appreciation for their subtleties andlimitations. There are several excellent books on time-series analysis at varying levels ofdifficulty and abstraction. But few of those books are linked to software tools that canimmediately be applied to data analysis.
I wrote this book to provide a step-by-step guide to essential time-series techniquesfromthe incredibly simple to the quite complexand, at the same time, to demonstrate how thesetechniques can be applied in the Stata statistical package.
Why Stata? There are, after all, a number of established, powerful statistical packagesoffering time-series tools. Interestingly, the conventions adopted by these programs fordescribing and analyzing time series vary widely, much more widely than the conventions usedfor cross-section techniques and classical hypothesis testing. Some of these packages focus primarily on time series and can be used on non-time-series questions only with a bit of difficulty. Others have to twist their time-series procedures into a form that fits the rest of the structure of their package.
I helped out in a small way when Stata was first introduced. At that time, the most frequent question posed by users (and potential users) was, When will time series be available? For a long time, we would tell users (completely sincerely) that these techniques would appear in the next release, in six to twelve months. However, we repeatedly failed to deliver on this promise. Version after version appeared with many new features, but not time series. I moved on to other endeavors, remaining a Stata user but not a participant in its production. Like other users, I kept asking for time-series featuresI needed them in my own research. I finally became frustrated and, using Statas programming capabilities, cobbled together some primitive Stata functions that helped a bit.
Why the delay? Part of the reason was other, more time-critical demands on what was, at the beginning, a small company. However, I think the primary reason was StataCorps commitment to what they call the human-machine interface. There are lots of packages that reliably calculate estimates of time-series models. Many of them are difficult to use. They present a series of obstacles that must be overcome before you can test your hypotheses on data. Frequently, it is challenging to thoroughly examine all aspects of your data. And they make it onerous to switch directions as the data begin to reveal their structure.
Stata makes these tasks easyat least, easy by comparison to the alternatives. I find that the facility of Stata contributes to better analyses. I attempt more, I look more deeply, because it is easy. The teams that work for me use several different packages, not just Stata, depending on the task at hand. I find that I get better, more thorough analyses from the team members using Stata. I do not think it is a coincidence.
When Stata finally gained time-series capabilities, it incorporated a design that retains the ease of use and intuitiveness that has always been the hallmark of this package. That is why I use Stata rather than any of the other candidate packages.
Despite the good design poured into Stata, time-series analysis is still tough. That is just the nature of the time-series inference task. I tend to learn new programs by picking up the manual and playing around. I certainly have learned a lot of the newer, more complex features of Stata that way. However, I do not think it is easy to learn the time-series techniques of Stata just from reading the Stata Time-Series Reference Manual and it is a very well-written manual. I knowI tried. For a long time, I stuck with my old, home-brew Stata functions to avoid the task of learning something different, even after members of my staff had adopted the new Stata tools.