Path: blob/master/lessons/lesson_17/Oil_residuals.ipynb
1904 views
Kernel: Python 3
Analyzing Oil Markets using Residuals
Today we will be analyzing oil markets using the us dollar, industrial production (as a proxy for demand) and the vix
In [1]:
In [2]:
Notice I have different frequencies throughout these datasets
In [4]:
Out[4]:
In [5]:
Out[5]:
In [6]:
Out[6]:
Define a little function to convert the "DATE" column to datetime, resample to quarterly, and make it the index
In [7]:
In [8]:
Out[8]:
In [9]:
Out[9]:
In [10]:
Out[10]:
In [11]:
Out[11]:
<matplotlib.axes._subplots.AxesSubplot at 0x10983d048>
issue with scale, to understand the data in graph
In [12]:
In [13]:
In [14]:
Out[14]:
<matplotlib.axes._subplots.AxesSubplot at 0x10f1c1eb8>
In [15]:
Out[15]:
<matplotlib.axes._subplots.AxesSubplot at 0x10f2c40f0>
In [18]:
Out[18]:
In [19]:
Out[19]:
Lets look at the Residuals
In [20]:
In [21]:
Out[21]:
<matplotlib.axes._subplots.AxesSubplot at 0x1a1a4b1fd0>
In [22]:
Out[22]:
/anaconda3/lib/python3.6/site-packages/statsmodels/compat/pandas.py:56: FutureWarning: The pandas.core.datetools module is deprecated and will be removed in a future version. Please use the pandas.tseries module instead.
from pandas.core import datetools
Key events in the oil market
March 1999: OPEC Production Cut
2010-2011: Arab Spring/ Libyan civil war
2015 - Present: reduction in oil investment due to shale boom
In [23]:
Out[23]:
<matplotlib.axes._subplots.AxesSubplot at 0x1c1a94e5c0>
this shows that log diff is very close to % change
In [24]:
Out[24]:
-0.09531017980432477
In [28]:
Out[28]:
False
In [27]:
Out[27]:
-0.09531017980432477 0.09531017980432477