A Complete Introduction To Time Series Analysis (with R)

During these times of the Covid19 pandemic, you have perhaps heard about the collaborative efforts to predict new Covid19 Cases using Time Series analysis (if you haven’t yet, go check out this excellent article: https://towardsdatascience.com/forecasting-covid-19-cases-in-india-c1c410cfc730). Indeed, many of us are aware of the importance of Time Series Analysis in modern life: weather forecasting, stock market prediction, and financial applications, multiple fields of scientific studies, etc. As such, I decided to take the task of sharing my humble knowledge of the more subtle aspects of time series analysis, which I intend to cover in this series, by covering a balanced integration of both theory and practical examples with R.
Prerequisites
In these tutorials, although I will make an effort to explain things as clearly as possible, it is important to clarify that I intend these tutorials to be of a somehow rather advanced level, and so some mathematical maturity is expected. Therefore I will be assuming some knowledge of calculus, linear algebra, probability, and statistics. In particular, it will be helpful if you are comfortable with:
- High-school algebra manipulations
- Partial derivatives and infinite series (especially geometric series)
- Basic probability concepts such as expectation, variance, covariance, and correlation
- Probability concepts of pdfs, CDFs, and distributions (in particular the univariate and multivariate normal distribution, for much later in the series)
- Hypothesis testing (for normal and chi-square variables, p-values, confidence intervals)
- Good knowledge of linear algebra (manipulations of matrices, vectors, inner/dot products, inverting matrices, solving systems of linear equations)
- Some very basic knowledge of complex numbers (definition, modulo, unit circle)
- Some knowledge of analysis and algebra II is helpful but not required
- Some knowledge of R
For some of these, I will often make quick remainders, and I only show certain proofs that are the most relevant.
Appendices (Review Articles)
The following is a collection of review cheat-sheets with all the background you need to know to understand the content in this article series. Check it out whenever you feel stuck! (or want to review for fun) :)
- Linear Algebra: https://readmedium.com/appendix-linear-algebra-1a440a25e47a
- Probability : https://medium.com/@hair.parra/appendix-probability-f65c1160e806
- Statistics: https://medium.com/@hair.parra/appendix-statistics-ee3b02ce031b
- Complex Variables: https://medium.com/@hair.parra/appendix-complex-variables-65ee3861b3c4
Other sources
- Linear Algebra: http://cs229.stanford.edu/section/cs229-linalg.pdf
- Probability: http://cs229.stanford.edu/section/cs229-prob.pdf
- Calculus: https://www.whitman.edu/mathematics/multivariable/multivariable.pdf
- Statistics: https://home.ubalt.edu/ntsbarsh/Business-stat/StatSummaySheet.pdf
- Basic R: https://cran.r-project.org/doc/contrib/Paradis-rdebuts_en.pdf
What’s the plan?
Next, you will find a list of the topics I intend to cover (to be updated). As I write down the articles for the different topics, I will update the respective links in the list below (click on the words to go to the respective page). Each lesson will contain a mix between theory, graphs, and R examples with full code, when pertinent, as well as insights and more!
- Introduction - Semi-parametric models - Models with structure - General strategy for analysis
- Stationary processes, AR(1) and MA(1) - Stationary processes - IID Noise - White Noise Process - Random Walks - First-order Autoregressive Process AR(1) - First-order Moving Average MA(1)
- Classical Decomposition Model - Estimating trends - Estimating seasonality - Classical Decomposition Analysis
- Differencing and Tests for Stationarity - Differencing - Properties of the autocovariance function - Estimating Autocorrelation - Tests for Stationarity
- Prediction I : Best Predictors - Best predictor of lag n+h - Best linear predictor of lag n+h
- Linear Processes - q-correlation - Linear Processes - Introduction to Time Series operators
- Estimation of mu and the ACF function - Estimation of mu - Estimation of the ACF function
- Prediction II: Forecasting - Best Linear Predictor (Part I) - Best Linear Predictor (Part II) - Durbin-Levinson Algorithm and the PACF - Innovations Algorithm
- Auto-regressive Moving Average ARMA(p,q) - Causality, Invertibility, and Stationarity of ARMA(1,1) processes - Causality, Invertibility, and Stationarity of ARMA(p,q) processes - The ACF and PACF functions
- Prediction III: Forecasting with ARMA(p,q) models - Innovations Algorithm for ARMA(p,q)
- Estimation of ARMA(p,q) coefficients - Yale-Walker equations for AR(p) - Burg’s algorithm for AR(p) - Innovations algorithm for MA(q) - Hannan-Rissanen algorithm for ARMA(p,q) - Moment estimators - Gaussian Time Series
- Model Selection of ARMA(p,q) models - AIC, AICc, and BIC metrics
- Advanced Topics - ARIMA models - SARIMA models - Exogenous models
- Projects - Why is it so hard to predict the stock market
Last words
I have created these tutorials in the hope that you will be able to understand in-depth what Time-Series analysis is about. Have fun learning!
If you like my work or have suggestions, find typos, etc. please don’t hesitate to leave them in the comments!
Follow me at
- https://blog.jairparraml.com/
- https://www.linkedin.com/in/hair-parra-526ba19b/
- https://github.com/JairParra
- https://medium.com/@hair.parra
Connect with me on LinkedIn
Copyright

http://creativecommons.org/licenses/by-nc-nd/4.0
All original content, including the presentation of mathematical formulas and examples provided, is the exclusive property of Hair Albeiro Parra Barrera, copyright protected. Please contact me via LinkedIn for business purposes.





