avatarHair Parra

Free AI web copilot to create summaries, insights and extended knowledge, download it at here

2380

Abstract

e><p id="2126">The first point says that we have some mean, whatever it might be, which is a function independent of t, that is, it does not depend on any particular timestep. In the second point, we define the <b>autocovariance function</b> by the letter gamma, of two observations at times t and s. In order for the process to be stationary, we require that the covariance function of Xt at lags t and t+h is <b>also independent </b>of t. That is, we only have covariances for lags 0,1,…,m, say, after which, it should get repeated again.</p><figure id="dcdf"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*XDArs21gN3JDJleea965_A.png"><figcaption></figcaption></figure><p id="c4be"><b>Strong stationarity</b></p><figure id="47e4"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*YftTozbpG6sDoW4hZffbAw.png"><figcaption></figcaption></figure><p id="fad0">This time, we require in addition that the <b>joint distribution</b> of the process shifted by a lag s is <b>the same</b>. This is indeed much stronger than the previous definition.</p><p id="e807">Ok, so what do we do with this? It turns out that we would much more like to work with stationary series than non-stationary ones, and in fact, most of the theorems and propositions that we will are based on these assumptions. If a series is not stationary, the idea is to <b>make it into one </b>(we will see how in a later article ).</p><h2 id="fd39">Autocorrelation function</h2><p id="f6f7">The <b>autocovariance </b>function might seem a little funky at first, but it is in fact, along the <b>autocorrelation function (ACF), </b>is an essential tool for Time Series analysis. Let’s recall the definition of the correlation between two random variables:</p><figure id="883d"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*9rq4hDanlFnlFg2jxI6vsw.png"><figcaption></figcaption></figure><p id="3350">This tells us how strongly related or “similar” are two variables. The ACF of a time series uses the exact same concept, except that using the autocovariance formula we saw before; that is</p><figure id="72eb"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*ITPKqjsCFPp6MCAY-OwSDg.png"><figcaption></figcaption></figure><figure id="f732"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*LLfMjxFwxAl1vJ-xIOCCjA.png"><figcaption></figca

Options

ption></figure><p id="1a6a">So we see that this is no more than the good old correlation. As you should know, this ranges between -1 (indicating <b>negative correlation</b>) and 1 (indicating <b>positive correlation</b>). The main idea is that, if we plot the ACF, a stationary series will show most or all of the points within certain confidence bounds, without any predictable pattern, like in the following plot:</p><figure id="a966"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*PVftoCvjuqGU-ik5-mIQQA.png"><figcaption>The points at all lags are within the confidence bounds, without any predictable pattern</figcaption></figure><h2 id="2601">Next time</h2><p id="d536"><a href="https://medium.com/@hair.parra/a-complete-introduction-to-time-series-analysis-with-r-stationary-processesii-e0f66d10051a">Next time</a>, we will see illustrate these concepts with various processes that are and are not stationary, along with the <b>How to R </b>sections to produce these plots. Stay tuned!</p><h2 id="841c">Previous article</h2><p id="b040"><a href="https://medium.com/@hair.parra/a-complete-introduction-to-time-series-analysis-with-r-models-with-structure-932e20c7d832">Models with Structure</a></p><h2 id="dba4">Main page</h2><div id="5775" class="link-block"> <a href="https://readmedium.com/a-complete-introduction-to-time-series-analysis-with-r-9882f2d44c9d"> <div> <div> <h2>A Complete Introduction To Time Series Analysis (with R)</h2> <div><h3>During these times of the Covid19 pandemic, you have perhaps heard about the collaborative efforts to predict new…</h3></div> <div><p>medium.com</p></div> </div> <div> <div style="background-image: url(https://miro.readmedium.com/v2/resize:fit:320/1*TL2PeOANEN4zG0_OqoHptQ.jpeg)"></div> </div> </div> </a> </div><h2 id="e833">Follow me at</h2><ol><li><a href="https://blog.jairparraml.com/">https://blog.jairparraml.com/</a></li><li><a href="https://www.linkedin.com/in/hair-parra-526ba19b/">https://www.linkedin.com/in/hair-parra-526ba19b/</a></li><li><a href="https://github.com/JairParra">https://github.com/JairParra</a></li><li><a href="https://medium.com/@hair.parra">https://medium.com/@hair.parra</a></li></ol></article></body>

A Complete Introduction To Time Series Analysis (with R):: Stationary processes

A zero-mean Stationary Time Series

In the last article, we discussed two important models with structure: the trend decomposition model and seasonal variation. We said that one of the most important steps in the general strategy for time series analysis was to remove the signal, i.e., remove either the estimated trend or seasonality or both. In this section, we will talk about stationary processes, and what it means to be stationary. Let’s dive right into it!

Stationary Processes

Let’s consider some time-series process Xt. Informally, it is said to be stationary if, after certain lags, it roughly behaves the same. For example, in the graph at the beginning of the article, we see that although there is some fluctuation, the points seem to wander around zero, in particular, this is called a mean-zero process. We will define more precisely what this means next. For this purpose, we will focus on studying the second moments, i.e., mean, covariance, and variance of a certain process.

There are two kinds of stationarity: weak stationarity and strong stationarity. Both of these are defined below. If you need a refresher on expectation, covariance, variance, and distributions, make sure to check these notes from Standford’s CS229 machine learning course.

Let’s now check these definitions.

Weak stationarity

The first point says that we have some mean, whatever it might be, which is a function independent of t, that is, it does not depend on any particular timestep. In the second point, we define the autocovariance function by the letter gamma, of two observations at times t and s. In order for the process to be stationary, we require that the covariance function of Xt at lags t and t+h is also independent of t. That is, we only have covariances for lags 0,1,…,m, say, after which, it should get repeated again.

Strong stationarity

This time, we require in addition that the joint distribution of the process shifted by a lag s is the same. This is indeed much stronger than the previous definition.

Ok, so what do we do with this? It turns out that we would much more like to work with stationary series than non-stationary ones, and in fact, most of the theorems and propositions that we will are based on these assumptions. If a series is not stationary, the idea is to make it into one (we will see how in a later article ).

Autocorrelation function

The autocovariance function might seem a little funky at first, but it is in fact, along the autocorrelation function (ACF), is an essential tool for Time Series analysis. Let’s recall the definition of the correlation between two random variables:

This tells us how strongly related or “similar” are two variables. The ACF of a time series uses the exact same concept, except that using the autocovariance formula we saw before; that is

So we see that this is no more than the good old correlation. As you should know, this ranges between -1 (indicating negative correlation) and 1 (indicating positive correlation). The main idea is that, if we plot the ACF, a stationary series will show most or all of the points within certain confidence bounds, without any predictable pattern, like in the following plot:

The points at all lags are within the confidence bounds, without any predictable pattern

Next time

Next time, we will see illustrate these concepts with various processes that are and are not stationary, along with the How to R sections to produce these plots. Stay tuned!

Previous article

Models with Structure

Main page

Follow me at

  1. https://blog.jairparraml.com/
  2. https://www.linkedin.com/in/hair-parra-526ba19b/
  3. https://github.com/JairParra
  4. https://medium.com/@hair.parra
Time Series Analysis
Machine Learning
R
Forecasting
Statistics
Recommended from ReadMedium