avatarHair Parra

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

2436

Abstract

ze:fit:800/1*HVXT6h2YqnOBtg9NdCkzJA.png"><figcaption></figcaption></figure><figure id="996a"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*IiuQZF9S36FmSpo5EArtAg.png"><figcaption></figcaption></figure><p id="2bde">I leave it to you to verify that for the case h=-1, we obtain the exact same result. Is this a coincidence? I think not!</p><figure id="d640"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*AOPvNJh4aJn-F-A-tXpo4w.png"><figcaption></figcaption></figure><figure id="7d77"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*OjVSMqxAdiwCguY1FcVc7g.png"><figcaption></figcaption></figure><p id="d2b0">Why is the last case true? This is because</p><figure id="c166"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*pRlZh6tbAkmz5MqeAvR3mw.png"><figcaption></figcaption></figure><p id="9070">so since abs(h) > 1, these indices will never be the same and therefore the Zt’s will be uncorrelated, therefore, by the laws of expectation, each expectation of the product of two Zt’s with different indexes will become the product of their expectations, so this will just be 0.</p><h2 id="497f">ACF of the MA(1)</h2><p id="15dd">If you divide each of the cases above by ACV(0), we obtain the ACF function of the MA(1) as follows:</p><figure id="7528"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*c4Idq7VW7XLZ9dOzjkWvIg.png"><figcaption></figcaption></figure><h2 id="658f">How to R</h2><p id="1d24">Let’s now explore how we can produce and analyze the plots for this in R:</p> <figure id="15a3"> <div> <div>

            <iframe class="gist-iframe" src="/gist/JairParra/6091f33abad8fe71f42f48292919fa8c.js" allowfullscreen="" frameborder="0" height="undefined" width="undefined">
          </div>
        </div>
    </figure></iframe></div></div></figure><p id="d0ec">This time around, we only specify the <code>ma</code> part. Although we will not talk about this until much later, try specifying both the <code>ar</code> and the <code>ma</code> parts at the same time and see what happens! Now we obtain both of the plots for the data and the ACF:</p>
    <figure id="2c2a">
        <div>
          <div>
            
            <iframe class="gist-iframe" src="/gist/JairParra/0e351fc4c51b1aef6a1b34f7000e8fea.js" allowfullscreen="" frameborder="0" heig

Options

ht="undefined" width="undefined"> </div> </div> </figure></iframe></div></div></figure><figure id="87b2"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*yKn203iqGHoEEd9EnQzK1A.png"><figcaption></figcaption></figure><figure id="22e9"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*hscPCJOrt9E1uRJtr2mjOQ.png"><figcaption></figcaption></figure><p id="6ae0">Once again, we can clearly see that the series is mean-zero and stationary. What is interesting about the MA(1), is that the first lag autocorrelation will <b>always be really high, </b>while all other lags will typically have small values. Compare this to the AR(1) in the previous section!</p><h2 id="3768">Next time</h2><p id="5e87">And so that wraps up the section in stationary processes. But it’s far from being over yet! Next time, we will explore a bit more in-depth the <b>classical decomposition model</b>, as well as some powerful techniques to estimate the trend, which we did not mention in previous articles. Stay tuned, and happy learning!</p><h2 id="5be5">Previous article</h2><p id="23d0"><a href="https://readmedium.com/a-complete-introduction-to-time-series-analysis-with-r-stationary-processesiii-c0574bc913b">AR(1) process</a></p><h2 id="d0a5">Main page</h2><div id="0cf2" 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="2f49">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):: MA(1)

In the last article, we explored the famous AR(1) process, and we saw that it was a mean-zero stationary process, with an ACF function that presented exponential growth (or decay, depending on the values for phi). This time, we will explore the Moving-average MA(1) process. Without anything else to say, let’s get to it.

Moving-average MA(1)

Dependence graph of the moving MA(1) process

What is this saying? This says that our observations depend on present time noise, and a proportion of past noise, one step back in time. For the MA(1), we have that

This time, it’s easy to see that it is a mean-zero process:

For the ACV, however, we have to consider four cases: h=0,1,-1, |h|>1. First, we have that

Then,

I leave it to you to verify that for the case h=-1, we obtain the exact same result. Is this a coincidence? I think not!

Why is the last case true? This is because

so since abs(h) > 1, these indices will never be the same and therefore the Zt’s will be uncorrelated, therefore, by the laws of expectation, each expectation of the product of two Zt’s with different indexes will become the product of their expectations, so this will just be 0.

ACF of the MA(1)

If you divide each of the cases above by ACV(0), we obtain the ACF function of the MA(1) as follows:

How to R

Let’s now explore how we can produce and analyze the plots for this in R:

This time around, we only specify the ma part. Although we will not talk about this until much later, try specifying both the ar and the ma parts at the same time and see what happens! Now we obtain both of the plots for the data and the ACF:

Once again, we can clearly see that the series is mean-zero and stationary. What is interesting about the MA(1), is that the first lag autocorrelation will always be really high, while all other lags will typically have small values. Compare this to the AR(1) in the previous section!

Next time

And so that wraps up the section in stationary processes. But it’s far from being over yet! Next time, we will explore a bit more in-depth the classical decomposition model, as well as some powerful techniques to estimate the trend, which we did not mention in previous articles. Stay tuned, and happy learning!

Previous article

AR(1) process

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
Statistics
R
Forecasting
Recommended from ReadMedium