We examine the usual suspects: unemployment, inflation, real interest rate, foreign exchange rate, comparative GDP. Appendix 1 concisely explains the euro crisis in a video.
Dependencies:
- Linux, bash [not crucial, cross-platform prefered]
- Python: matplotlib, pandas [recommend Anaconda distribution]
- Modules: yi_1tools, yi_plot, yi_timeseries, yi_fred
CHANGE LOG
2015-02-03 Code review and revision.
2014-09-22 First version.
# NOTEBOOK settings and system details: [00-tpl v14.09.28]
# Assume that the backend is LINUX (our particular distro is Ubuntu, running bash shell):
print '\n :: TIMESTAMP of last notebook execution:'
!date
print '\n :: IPython version:'
!ipython --version
# Automatically reload modified modules:
%load_ext autoreload
%autoreload 2
# 0 will disable autoreload.
# Generate plots inside notebook:
%matplotlib inline
# DISPLAY options
from IPython.display import Image
# e.g. Image(filename='holt-winters-equations.png', embed=True)
from IPython.display import YouTubeVideo
# e.g. YouTubeVideo('1j_HxD4iLn8')
from IPython.display import HTML # useful for snippets
# e.g. HTML('<iframe src=http://en.mobile.wikipedia.org/?useformat=mobile width=700 height=350></iframe>')
import pandas as pd
print '\n :: pandas version:'
print pd.__version__
# pandas DataFrames are represented as text by default; enable HTML representation:
# [Deprecated: pd.core.format.set_printoptions( notebook_repr_html=True ) ]
pd.set_option( 'display.notebook_repr_html', False )
# MATH display, use %%latex, rather than the following:
# from IPython.display import Math
# from IPython.display import Latex
print '\n :: Working directory (set as $workd):'
workd, = !pwd
print workd + '\n'
:: TIMESTAMP of last notebook execution: Fri Feb 6 07:54:55 PST 2015 :: IPython version: 2.3.0 :: pandas version: 0.15.0 :: Working directory (set as $workd): /home/yaya/Dropbox/ipy/fecon235/nb
from yi_1tools import *
from yi_fred import *
from yi_plot import *
from yi_timeseries import *
# EU data has not been updated recently (one year lag!),
# thus we shall use France as PROXY for the time being:
unempeu = getfred( m4unempfr )
# unempeu = getfred( m4unempeu )
# Uncomment when the update situation changes.
plotfred(unempeu)
If we looked at youth unemployment, the numbers would look far worse. Likewise for single country unemployment, for example, from Greece or Portugal. The situation was more alarming in the late 1990's. Employment seems to be improving over the longer term, as seen in the trend next.
# What is the long-term unemployment trend?
unemptrend = trend( unempeu )
plotfred( unemptrend )
:: regresstime slope = -0.00406865653928
# Deviation from long-term trend:
unempdev = todf( unempeu - unemptrend )
plotfred(unempdev)
The introduction of the euro currency seems to have improved employment post-1999, but then the Great Recession in America has global effects.
2015-02-05: additional 1.5% unemployment could bring massive civil unrest.
infleu = getfred(m4infleu)
# Compute inflation rate from levels:
infreu = pcent(infleu, 12).dropna()
plotfred(infreu)
In the 21st century, we see two deflationary periods: first, due to the Great Recession globally, second, due to the euro crisis. The latter showed that Euro monetary policy also needs an unified fiscal policy across the Eurozone.
The euro crisis is renewed in 2015, again exemplified by alarming Greek debt and problems with forced austerity.
stats(infreu)
Y count 216.000000 mean 1.875247 std 0.910160 min -0.848638 25% 1.285137 50% 2.080548 75% 2.394655 max 4.117544 :: Index on min: Y 2009-10-01 dtype: datetime64[ns] :: Index on max: Y 2008-09-01 dtype: datetime64[ns] :: Head: Y T 1997-01-01 2.202703 1997-02-01 1.919892 1997-03-01 1.657404 1997-04-01 1.388867 1997-05-01 1.216077 1997-06-01 1.102625 1997-07-01 1.065886 :: Tail: Y T 2014-06-01 0.375086 2014-07-01 0.319713 2014-08-01 0.279173 2014-09-01 0.239913 2014-10-01 0.230103 2014-11-01 0.205718 2014-12-01 0.074302 :: Correlation matrix: Y Y 1
# Inflation following Great Recession:
georet(infleu[t06], 12)
[2.07, 2.07, 0.34, 12]
# Holt-Winters forecast on inflation level is more suitable due to its trend properties:
holtfred(infleu, 12)
Forecast 0 1.000000 1 1.000729 2 1.000893 3 1.001056 4 1.001220 5 1.001383 6 1.001546 7 1.001710 8 1.001873 9 1.002037 10 1.002200 11 1.002364 12 1.002527
2015-02-05: Using level data (not rates), inflation rate is forecasted to be 0.25% over the next 12 months. ECB just started QE, so we shall have to see if inflation will move towards the target rate of 2.0%.
# 3-month LIBOR for Euros, resampled monthly from daily data:
libeur = monthly( getfred(d4libeur) )
plotfred( libeur )
# We compute the real rate for 3-month tenor:
realrate = todf( libeur - infreu )
plotfred(realrate)
The negative real rates after 2010 explains increasing gold price, and its decline as well.
2014-09-22: Still no compelling reason to lend to Europe, unless bond prices rally on LSAP (unlikely since it's confined to ABS asset backed bonds, not sovereigns).
2015-02-05: ECB will start QE, where sovereign bonds will be purchased by respective national central banks. There is no risk-sharing among the EU members.
# Real Eurozone GDP, resampled monthly:
gdpeur = getfred( m4gdpeur )
plotfred( gdpeur )
# Let's now look the YoY growth rate:
gdpeur_rate = pcent( gdpeur, 12).dropna()
plotfred( gdpeur_rate )
# Real Eurozone GDP geometric growth after 2007 looks negative:
georet( gdpeur['2007':], 12 )
[-0.62, -0.62, 0.94, 12]
# Get the forex rate for EURUSD:
eurusd = getfred( m4eurusd )
plotfred( eurusd )
:: EURUSD synthetically goes back monthly to 1971.
# Real Eurozone GDP in dollar terms:
gdpeurusd = todf( eurusd * gdpeur )
plotfred( gdpeurusd )
# Real Eurozone GDP growth after 2007 in dollars is slightly positive:
georet( gdpeurusd['2007':], 12 )
[0.25, 0.7, 9.52, 12]
Note the increase in volatility due to forex factor.
gdpusr = getfred( m4gdpusr )
# Real GDP data for US goes back further than EU, so for a comparative look:
plotfred( gdpusr['1996':] )
# Real US GDP growth in dollars after 2007 is superior to EU:
georet( gdpusr['2007':], 12 )
[1.07, 1.08, 0.91, 12]
eu2us = todf( gdpeurusd / gdpusr )
plotfred( eu2us )
2015-02-05: After 2007, Eurozone grew only 0.25% in dollar terms, whereas the US grew at 1.07% -- thus one can see the relative size of the Eurozone economy shrinking recently.
(Related fact: the allocation of Eurozone equities is also shrinking in global portfolios.)
plotfred( trend( eu2us ) )
:: regresstime slope = 0.000102444675953
Over the long-term horizon, the Eurozone economy will be roughly a fifth of the United States.
# Source: Bloomberg
YouTubeVideo( 'C8xAXJx9WJ8' )