Skip to content

Commit

Permalink
Changing documentation image
Browse files Browse the repository at this point in the history
  • Loading branch information
paulozip committed Nov 28, 2019
1 parent 6949d47 commit dffe742
Show file tree
Hide file tree
Showing 28 changed files with 156 additions and 35 deletions.
Binary file modified docs/build/doctrees/environment.pickle
Binary file not shown.
Binary file modified docs/build/doctrees/help.doctree
Binary file not shown.
Binary file modified docs/build/doctrees/how_to_choose_terms.doctree
Binary file not shown.
Binary file modified docs/build/doctrees/how_to_use.doctree
Binary file not shown.
Binary file modified docs/build/doctrees/index.doctree
Binary file not shown.
Binary file modified docs/build/doctrees/installation.doctree
Binary file not shown.
Binary file modified docs/build/doctrees/upload_data.doctree
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/build/html/.buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: f62bd4d7b7990fc004f5d4616095baf9
config: 48a9c358a7593c89aef0b451e3bd7733
tags: fbb0d17656682115ca4d033fb2f83ba1
Binary file added docs/build/html/_images/arauto_acf_pacf.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/build/html/_images/arauto_charts_menu.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/build/html/_images/arauto_forecast_plot.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/build/html/_images/arauto_your_data_menu.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/build/html/_images/logo.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
61 changes: 58 additions & 3 deletions docs/build/html/_sources/how_to_choose_terms.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,59 @@
How to choose the parameters for the model (under construction)
===============================================================
How to choose the parameters for the model
==========================================

This page is under construction.
Something it might be dificult to estimate the amount of terms that your model needs, chiefly when it comes to ARIMA. In this part, you be shown to some types of analysis that you can do to estimate the parameters of your model.

**Important**: by default, Arauto will try to find the best parameters for ARIMA or SARIMA for you. The recommended values will be shown below the ACF and PACF plots, but you also can explore different parameters.

The ACF and PACF function
^^^^^^^^^^^^^^^^^^^^^^^^^

One good and intuitive approach to estimate the terms for seasonal and non-seasonal autoregressive models is to look at autocorrelation function and partial autocorrelation function. We are not going too deep in theorical concepts around these functions, but there are great resources around the web (see References section below). Basically, **the autocorrelation function will show the relationship between a point in time and lagged values**.

For instance, imagine that we have a non-null time series collected in a daily basis. An autocorrelation of lag 1 will measure the relationship between the today's value (Yt) and yesterday's value (Yt-1). The values of the autocorrelation function and partial autocorrelation function can help us to estimate AR (p) terms, and MA (q) terms, respectively.

To estimate the correct amount of terms, **we must use a stationary series, which is basically a time series where there is a constant mean and variance over time**. Arauto provides some resources to make a time series stationary, like log transformations, first differences, and so on (you may want to check `the How to Use Arauto <how_to_use.html>`_ section to know more about transformation functions). Also, **Arauto automatically generate plots for autocorrelation function (ACF) and partial autocorrelation function (PACF)**, making it easier to interpret and identify AR and MA terms.

**Example**

Let's use an example to understand more about ACF and PACF. Here is the plots for the Monthly Wine Sales dataset on Arauto, which is stationary after a log difference transformation.

.. image:: ../../img/arauto_acf_pacf.png

Estimating AR terms
^^^^^^^^^^^^^^^^^^^

The lollipop plot that you see above is the ACF and PACF results. **To estimate the amount of AR terms, you need to look at the PACF plot**. First, ignore the value at lag 0. It will always show a perfect correlation, since we are estimating the correlation between today's value with itself. Note that there is a blue area in the plot, representing the confidence interval. To estimate how much AR terms you should use, **start counting how many "lollipop" are above or below the confidence interval before the next one enter the blue area**.

So, **looking at the PACF plot above, we can estimate to use 3 AR terms for our model**, since lag 1, 2 and 3 are out of the confidence interval, and lag 4 is in the blue area.

Estimating I terms
^^^^^^^^^^^^^^^^^^
This is an easy part. **All you need to do to estimate the amount of I (d) terms is to know how many Differencing was used to make the series stationary**. For example, **if you used log difference or first difference to transform a time series, the amount of I terms will be 1**, since Arauto takes the difference between the actual value (e.g. today's value) and 1 previous value (e.g. yesterday's value).

Estimating MA terms
^^^^^^^^^^^^^^^^^^^

Just like the PACF function, **to estimate the amount of MA terms, this time you will look at ACF plot**. The same logic is applied here: how much lollipops are above or below the confidence interval before the next lollipop enters the blue area?

In our example, **we can estimate 2 MA terms, since we have lag 1 and 2 out of the confidence interval**.

Estimating Seasonal AR terms
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

If your data has seasonality and you want to use a Seasonal ARIMA model, you need to inform the seasonal terms for AR, I, and MA. **The process is quite similar to non-seasonal AR, and you will still using the ACF and PACF function for that**. To estimate the amount of AR terms, you will look one more time to the PACF function. **Now, instead of count how many lollipops are out of the confidence interval, you will count how many seasonal lollipops are out**.

For example, if your data was collected in a monthly basis and you have yearly seasonality, you need to check if the "lollipop" at lag 12 is out of the confidence interval area. **In case of positive result, you need to add 1 term for Seasonal AR. In the plot above, we can see that the value at lag 12 is out of the blue area of the confidence interval**, so we will add 1 terms for seasonal AR (SAR).

Estimating Seasonal I terms
^^^^^^^^^^^^^^^^^^^^^^^^^^^

The same logic of estimating non-seasonal differencing is applied here. If you used seasonal differencing to make the time series stationary (e.g. the actual value (Yt) substracted by 12 previous month (Yt-12)), you will add 1 term to seasonal differencing. In our example, **we just used log differencing to make the time series stationary**, we do not used seasonal differencing as well. So, **we will not add 1 terms for seasonal differencing**.

Estimating Seasonal MA terms
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
For seasonal moving average (SMA), we will be looking at the ACF plot and use the same logic of estimating SAR terms. For our example, **we will be using not 1, but 2 terms for SMA. Why? Because we have significant correlation at lag 12 and lag 24**.

Final considerations
^^^^^^^^^^^^^^^^^^^^
At the end of this process, you will have all the terms needed to build your model. Below the ACF and PACF plot, Arauto will recommend the same amount of terms that we identified in this tutorial for p, d, q, P, D, and Q: (3, 1, 2)x(1, 0, 2). If you want to let Arauto optimize these parameters, you can select the option **"Find the best parameters for me"** and Arauto will apply Grid Search to your model. Keep in mind that this is high computational step, be sure that you have enough resources for this process.
2 changes: 1 addition & 1 deletion docs/build/html/_static/searchtools.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ var Search = {
},

query : function(query) {
var stopwords = ["in","with","they","near","or","are","was","and","a","be","but","the","that","there","on","it","these","such","will","no","of","this","not","by","as","if","their","is","at","to","then","into","for"];
var stopwords = ["of","this","the","and","not","there","their","near","such","with","is","that","into","no","they","for","at","are","if","was","but","by","on","as","be","will","a","in","to","or","it","then","these"];

// Stem the searchterms and add them to the correct list
var stemmer = new Stemmer();
Expand Down
8 changes: 4 additions & 4 deletions docs/build/html/help.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<link rel="top" title="Arauto 0.1.0 documentation" href="index.html" />
<link rel="prev" title="How to choose the parameters for the model (under construction)" href="how_to_choose_terms.html" />
<link rel="prev" title="How to choose the parameters for the model" href="how_to_choose_terms.html" />
</head>
<body>
<div class="related">
Expand All @@ -36,7 +36,7 @@ <h3>Navigation</h3>
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="how_to_choose_terms.html" title="How to choose the parameters for the model (under construction)"
<a href="how_to_choose_terms.html" title="How to choose the parameters for the model"
accesskey="P">previous</a> |</li>
<li><a href="index.html">Arauto 0.1.0 documentation</a> &raquo;</li>
</ul>
Expand Down Expand Up @@ -88,7 +88,7 @@ <h3><a href="index.html">Table Of Contents</a></h3>

<h4>Previous topic</h4>
<p class="topless"><a href="how_to_choose_terms.html"
title="previous chapter">How to choose the parameters for the model (under construction)</a></p>
title="previous chapter">How to choose the parameters for the model</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/help.txt"
Expand Down Expand Up @@ -118,7 +118,7 @@ <h3>Navigation</h3>
<a href="genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="how_to_choose_terms.html" title="How to choose the parameters for the model (under construction)"
<a href="how_to_choose_terms.html" title="How to choose the parameters for the model"
>previous</a> |</li>
<li><a href="index.html">Arauto 0.1.0 documentation</a> &raquo;</li>
</ul>
Expand Down
64 changes: 60 additions & 4 deletions docs/build/html/how_to_choose_terms.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>How to choose the parameters for the model (under construction) &mdash; Arauto 0.1.0 documentation</title>
<title>How to choose the parameters for the model &mdash; Arauto 0.1.0 documentation</title>

<link rel="stylesheet" href="_static/default.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
Expand Down Expand Up @@ -51,9 +51,50 @@ <h3>Navigation</h3>
<div class="bodywrapper">
<div class="body">

<div class="section" id="how-to-choose-the-parameters-for-the-model-under-construction">
<h1>How to choose the parameters for the model (under construction)<a class="headerlink" href="#how-to-choose-the-parameters-for-the-model-under-construction" title="Permalink to this headline"></a></h1>
<p>This page is under construction.</p>
<div class="section" id="how-to-choose-the-parameters-for-the-model">
<h1>How to choose the parameters for the model<a class="headerlink" href="#how-to-choose-the-parameters-for-the-model" title="Permalink to this headline"></a></h1>
<p>Something it might be dificult to estimate the amount of terms that your model needs, chiefly when it comes to ARIMA. In this part, you be shown to some types of analysis that you can do to estimate the parameters of your model.</p>
<p><strong>Important</strong>: by default, Arauto will try to find the best parameters for ARIMA or SARIMA for you. The recommended values will be shown below the ACF and PACF plots, but you also can explore different parameters.</p>
<div class="section" id="the-acf-and-pacf-function">
<h2>The ACF and PACF function<a class="headerlink" href="#the-acf-and-pacf-function" title="Permalink to this headline"></a></h2>
<p>One good and intuitive approach to estimate the terms for seasonal and non-seasonal autoregressive models is to look at autocorrelation function and partial autocorrelation function. We are not going too deep in theorical concepts around these functions, but there are great resources around the web (see References section below). Basically, <strong>the autocorrelation function will show the relationship between a point in time and lagged values</strong>.</p>
<p>For instance, imagine that we have a non-null time series collected in a daily basis. An autocorrelation of lag 1 will measure the relationship between the today&#8217;s value (Yt) and yesterday&#8217;s value (Yt-1). The values of the autocorrelation function and partial autocorrelation function can help us to estimate AR (p) terms, and MA (q) terms, respectively.</p>
<p>To estimate the correct amount of terms, <strong>we must use a stationary series, which is basically a time series where there is a constant mean and variance over time</strong>. Arauto provides some resources to make a time series stationary, like log transformations, first differences, and so on (you may want to check <a class="reference external" href="how_to_use.html">the How to Use Arauto</a> section to know more about transformation functions). Also, <strong>Arauto automatically generate plots for autocorrelation function (ACF) and partial autocorrelation function (PACF)</strong>, making it easier to interpret and identify AR and MA terms.</p>
<p><strong>Example</strong></p>
<p>Let&#8217;s use an example to understand more about ACF and PACF. Here is the plots for the Monthly Wine Sales dataset on Arauto, which is stationary after a log difference transformation.</p>
<img alt="_images/arauto_acf_pacf.png" src="_images/arauto_acf_pacf.png" />
</div>
<div class="section" id="estimating-ar-terms">
<h2>Estimating AR terms<a class="headerlink" href="#estimating-ar-terms" title="Permalink to this headline"></a></h2>
<p>The lollipop plot that you see above is the ACF and PACF results. <strong>To estimate the amount of AR terms, you need to look at the PACF plot</strong>. First, ignore the value at lag 0. It will always show a perfect correlation, since we are estimating the correlation between today&#8217;s value with itself. Note that there is a blue area in the plot, representing the confidence interval. To estimate how much AR terms you should use, <strong>start counting how many &#8220;lollipop&#8221; are above or below the confidence interval before the next one enter the blue area</strong>.</p>
<p>So, <strong>looking at the PACF plot above, we can estimate to use 3 AR terms for our model</strong>, since lag 1, 2 and 3 are out of the confidence interval, and lag 4 is in the blue area.</p>
</div>
<div class="section" id="estimating-i-terms">
<h2>Estimating I terms<a class="headerlink" href="#estimating-i-terms" title="Permalink to this headline"></a></h2>
<p>This is an easy part. <strong>All you need to do to estimate the amount of I (d) terms is to know how many Differencing was used to make the series stationary</strong>. For example, <strong>if you used log difference or first difference to transform a time series, the amount of I terms will be 1</strong>, since Arauto takes the difference between the actual value (e.g. today&#8217;s value) and 1 previous value (e.g. yesterday&#8217;s value).</p>
</div>
<div class="section" id="estimating-ma-terms">
<h2>Estimating MA terms<a class="headerlink" href="#estimating-ma-terms" title="Permalink to this headline"></a></h2>
<p>Just like the PACF function, <strong>to estimate the amount of MA terms, this time you will look at ACF plot</strong>. The same logic is applied here: how much lollipops are above or below the confidence interval before the next lollipop enters the blue area?</p>
<p>In our example, <strong>we can estimate 2 MA terms, since we have lag 1 and 2 out of the confidence interval</strong>.</p>
</div>
<div class="section" id="estimating-seasonal-ar-terms">
<h2>Estimating Seasonal AR terms<a class="headerlink" href="#estimating-seasonal-ar-terms" title="Permalink to this headline"></a></h2>
<p>If your data has seasonality and you want to use a Seasonal ARIMA model, you need to inform the seasonal terms for AR, I, and MA. <strong>The process is quite similar to non-seasonal AR, and you will still using the ACF and PACF function for that</strong>. To estimate the amount of AR terms, you will look one more time to the PACF function. <strong>Now, instead of count how many lollipops are out of the confidence interval, you will count how many seasonal lollipops are out</strong>.</p>
<p>For example, if your data was collected in a monthly basis and you have yearly seasonality, you need to check if the &#8220;lollipop&#8221; at lag 12 is out of the confidence interval area. <strong>In case of positive result, you need to add 1 term for Seasonal AR. In the plot above, we can see that the value at lag 12 is out of the blue area of the confidence interval</strong>, so we will add 1 terms for seasonal AR (SAR).</p>
</div>
<div class="section" id="estimating-seasonal-i-terms">
<h2>Estimating Seasonal I terms<a class="headerlink" href="#estimating-seasonal-i-terms" title="Permalink to this headline"></a></h2>
<p>The same logic of estimating non-seasonal differencing is applied here. If you used seasonal differencing to make the time series stationary (e.g. the actual value (Yt) substracted by 12 previous month (Yt-12)), you will add 1 term to seasonal differencing. In our example, <strong>we just used log differencing to make the time series stationary</strong>, we do not used seasonal differencing as well. So, <strong>we will not add 1 terms for seasonal differencing</strong>.</p>
</div>
<div class="section" id="estimating-seasonal-ma-terms">
<h2>Estimating Seasonal MA terms<a class="headerlink" href="#estimating-seasonal-ma-terms" title="Permalink to this headline"></a></h2>
<p>For seasonal moving average (SMA), we will be looking at the ACF plot and use the same logic of estimating SAR terms. For our example, <strong>we will be using not 1, but 2 terms for SMA. Why? Because we have significant correlation at lag 12 and lag 24</strong>.</p>
</div>
<div class="section" id="final-considerations">
<h2>Final considerations<a class="headerlink" href="#final-considerations" title="Permalink to this headline"></a></h2>
<p>At the end of this process, you will have all the terms needed to build your model. Below the ACF and PACF plot, Arauto will recommend the same amount of terms that we identified in this tutorial for p, d, q, P, D, and Q: (3, 1, 2)x(1, 0, 2). If you want to let Arauto optimize these parameters, you can select the option <strong>&#8220;Find the best parameters for me&#8221;</strong> and Arauto will apply Grid Search to your model. Keep in mind that this is high computational step, be sure that you have enough resources for this process.</p>
</div>
</div>


Expand All @@ -62,6 +103,21 @@ <h1>How to choose the parameters for the model (under construction)<a class="hea
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h3><a href="index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">How to choose the parameters for the model</a><ul>
<li><a class="reference internal" href="#the-acf-and-pacf-function">The ACF and PACF function</a></li>
<li><a class="reference internal" href="#estimating-ar-terms">Estimating AR terms</a></li>
<li><a class="reference internal" href="#estimating-i-terms">Estimating I terms</a></li>
<li><a class="reference internal" href="#estimating-ma-terms">Estimating MA terms</a></li>
<li><a class="reference internal" href="#estimating-seasonal-ar-terms">Estimating Seasonal AR terms</a></li>
<li><a class="reference internal" href="#estimating-seasonal-i-terms">Estimating Seasonal I terms</a></li>
<li><a class="reference internal" href="#estimating-seasonal-ma-terms">Estimating Seasonal MA terms</a></li>
<li><a class="reference internal" href="#final-considerations">Final considerations</a></li>
</ul>
</li>
</ul>

<h4>Previous topic</h4>
<p class="topless"><a href="upload_data.html"
title="previous chapter">How to upload your dataset</a></p>
Expand Down

0 comments on commit dffe742

Please sign in to comment.