<jupyter_start><jupyter_text>This is a demo notebook of some of the features of IEtools.py.IEtools includes tools to read FRED economic datahttps://fred.stlouisfed.org/in either csv or xls formats. IEtools also includes tools forfitting information equilibrium parameters and constructingdynamic equilibrium models (see Dynamic Equilibrium Examples.ipynb).The basic information equilibrium condition between two variablesA and B is given byp = dA/dB = k A/Bwith information transfer (IT) index k. In 'general equilibrium' (where A or B is not changing faster than the other), we have the solutionA = a B^korlog(A) = k log(B) + cIEtools has a function to solve for these parameters. In theinformation equilibrium condition, p = dA/dB is the abstract price.In 'general equilibrium', we havep = k a B^(k-1)The continuously compounded growth rates of these variables are also related. If the growth rate of A is g_a, B is g_b, and p is g_p then:g_a = k g_bg_p = (k-1) g_bg_p = g_a - g_bThis notebook shows some of these results for GDP and labor supply, showing Okun's law along the way.IEtools was tested using Python 3.6 as part of the Anaconda 4.4.0 package. All dependencies are included in Anaconda 4.4.0.<jupyter_code>import numpy as np
import IEtools
import pylab as pl
%pylab inline<jupyter_output><empty_output><jupyter_text>Read in the files<jupyter_code>filename1='C:/econdata/GDP.xls'
filename2='C:/econdata/PAYEMS.xls'
filename3='C:/econdata/CPIAUCSL.xls'
gdp = IEtools.FREDxlsRead(filename1)
lab = IEtools.FREDxlsRead(filename2)
cpi = IEtools.FREDxlsRead(filename3)<jupyter_output><empty_output><jupyter_text>Here's a plot of nominal GDP<jupyter_code>pl.plot(gdp['interp'].x,gdp['interp'](gdp['interp'].x))
pl.ylabel(gdp['name']+' [G$]')
pl.yscale('log')
pl.show()<jupyter_output><empty_output><jupyter_text>And here is nominal GDP growth<jupyter_code>pl.plot(gdp['growth'].x,gdp['growth'](gdp['growth'].x))
pl.ylabel(gdp['name']+' growth [%]')
pl.show()<jupyter_output><empty_output><jupyter_text>Fit information equilibrium parameters Here we take the information equilibrium model with A = nominal GDP, B = labor employed (PAYEMS), and p = CPI (all items). First we solve for the IT index and show the model. Note: this is a simple model with limited accuracy.<jupyter_code>result = IEtools.fitGeneralInfoEq(gdp['data'],lab['data'], guess=[1.0,0.0])
print(result)
print('IT index = ',np.round(result.x[0],decimals=2))
time=gdp['interp'].x
pl.plot(time,np.exp(result.x[0]*np.log(lab['interp'](time))+result.x[1]),label='model')
pl.plot(time,gdp['interp'](time),label='data')
pl.yscale('log')
pl.ylabel(gdp['name']+' [G$]')
pl.legend()
pl.show()<jupyter_output><empty_output><jupyter_text>And we can show the relationship between the growth rates (i.e. compute the inflation rate equal to the growth rate of the CPI)<jupyter_code>time=gdp['data'][:,0]

der1=gdp['growth'](time)-lab['growth'](time)
der2=cpi['growth'](time)
pl.plot(time,der1,label='model')
pl.plot(time,der2,label='data')
pl.legend()
pl.show()<jupyter_output><empty_output><jupyter_text>Additionally, rearranging the terms and looking at the growth rate, we can show a form of Okun's law. Since g_p = g_a - g_b, we can say g_b = g_a - g_p. The right hand side of the last equation when A is nominal GDP and p is the CPI is the CPI-deflated real GDP growth. Okun's law is an inverse relationship between the change in unemployment and RGDP growth, but in our case we will look at the direct relationship of RGDP growth and change in employment (PAYEMS).<jupyter_code>time=gdp['data'][:,0]

der1=gdp['growth'](time)-cpi['growth'](time)
der2=lab['growth'](time)
pl.plot(time,der1,label='model')
pl.plot(time,der2,label='data')
pl.legend()
pl.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1287313432835821, 'fraction_numerical': 0.00906183368869936, 'mean_word_length': 6.431683168316832, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '134605', 'license': 'MIT', 'n_tokens_mistral': 1332, 'n_tokens_neox': 1290, 'n_words': 390, 'path': 'IEtools Demo.ipynb', 'repo_name': 'infotranecon/IEtools', 'size': '3752'}