Welcome to the lesson on time series analysis. Time series are data that are collected at regular intervals. We will cover two statistical methods, autoregression and moving averages. This will give us the foundation to cover two more advanced methods, autoregressive moving averages and autoregressive integrated moving averages. From there, we will cover two machine-learning methods. The first is Kalman filters, and the more generalized, particle filters. The second is recurrent neural networks. Let’s get started. Let’s think a bit about what a stock price time series looks like. Most stock prices increase over time. Sadly, some stock prices also decrease over time. This means that the price shows a trend. This makes analyzing the prices difficult since the prices are non-stationary. By non-stationary, we mean that the data’s mean and standard deviation change over time. The goal of time series analysis is to use past data to predict future values. So, if the properties of the data change over time, the past is less useful in predicting the future. To work with data that is more likely to be stationary, and therefore, easier to model, we use stock returns and not stock prices. Moreover, to work with data that is more stationary and more normally distributed, we use the log of stock returns, which we call log returns.