# Applied Time Series Analysis with R

*Stéphane Guerrier, Roberto Molinari, Haotian Xu and Yuming Zhang*

*August 21 2019*

# Chapter 1 Introduction

Welcome to “Applied Time Series Analysis with `R`

”. This book is intended as a support for the course of STAT 463 (Applied Time Series Analysis) given at Penn State University. It contains an overview of the basic procedures to adequately approach a time series analysis with insight to more advanced analysis of time series. It firstly introduces the basic concepts and theory to appropriately use the applied tools that are presented in the second (and main) part of the book. In the latter part the reader will learn how to use descriptive analysis to identify the important characteristics of a time series and then employ modelling and inference techniques (made available through `R`

funtions) that allow to describe a time series and make predictions. The last part of the book will give introductory notions on more advanced analysis of time series where the reader will achieve a basic understanding of the tools available to analyse more complex characteristics of time series.

**under development**and it is therefore preferable to always access the text online to be sure you are using the most up-to-date version. Due to its current development, you may encounter errors ranging from broken code to typos or poorly explained topics. If you do, please let us know! Simply add an issue to the GitHub repository used for this document (which can be accessed here https://github.com/SMAC-Group/ts/issues) and we will make the changes as soon as possible. In addition, if you know RMarkdown and are familiar with GitHub, make a pull request and fix an issue yourself.

## 1.1 Conventions

Throughout this book, `R`

code will be typeset using a `monospace`

font which is syntax highlighted. For example:

```
a = pi
b = 0.5
sin(a*b)
```

Similarly, `R`

output lines (that usally appear in your Console) will begin with `##`

and will not be syntax highlighted. The output of the above example is the following:

`## [1] 1`

Aside from `R`

code and its outputs, this book will also insert some boxes that will draw the reader’s attention to important, curious or otherwise informative details. An example of these boxes was seen at the beginning of this introduction where an important aspect was pointed out to the reader regarding the “under construction” nature of this book. Therefore the following boxes and symbols can be used to represent information of different nature:

Using the same convention as in Hastie, Friedman, and Tibshirani (2001), the symbol 😱 indicates a technically difficult section which may be skipped without interrupting the flow of the discussion.

## 1.2 Bibliographic Note

This is not the first (or the last) book that has been written on time series analysis. Indeed, this can be seen as a book that brings together and reorganizes information and material from other sources structuring and tailoring it to a course in basic time series analysis. The main and excellent references (which are far from being an exhaustive review of literature) that can be used to have a more in-depth view of different aspects treated in this book are Cochrane (2005), Hamilton (1994) and Shumway and Stoffer (2010).

## 1.3 Acknowledgements

The text has benefited greatly from the contributions of many people who have provided extremely useful comments, suggestions and corrections. These are:

The authors are particularly grateful to James Balamuta who introduced them to the use of the different tools provided by the RStudio environment and greatly contributed to an earlier version of this book:

### C Proofs

Hastie, Trevor, Jerome Friedman, and Robert Tibshirani. 2001. *The Elements of Statistical Learning*. Vol. 1. 10. Springer series in statistics New York, NY, USA:

Cochrane, John H. 2005. “Time Series for Macroeconomics and Finance.” *Manuscript, University of Chicago*.

Hamilton, James Douglas. 1994. *Time Series Analysis*. Vol. 2. Princeton university press Princeton, NJ.

Shumway, R.H., and D.S. Stoffer. 2010. *Time Series Analysis and Its Applications: With R Examples*. Springer Texts in Statistics. Springer New York. https://books.google.com/books?id=NIhXa6UeF2cC.